Search in sources :

Example 6 with SwitchRepository

use of org.openkilda.persistence.repositories.SwitchRepository in project open-kilda by telstra.

the class FlowPathBuilderTest method setUp.

@Before
public void setUp() {
    SwitchRepository switchRepository = mock(SwitchRepository.class);
    SwitchPropertiesRepository switchPropertiesRepository = mock(SwitchPropertiesRepository.class);
    KildaConfigurationRepository kildaConfigurationRepository = mock(KildaConfigurationRepository.class);
    when(switchRepository.findById(any())).thenAnswer(invocation -> Optional.of(Switch.builder().switchId(invocation.getArgument(0)).build()));
    when(switchPropertiesRepository.findBySwitchId(any())).thenAnswer(invocation -> {
        Switch sw = Switch.builder().switchId(invocation.getArgument(0)).build();
        return Optional.of(SwitchProperties.builder().switchObj(sw).multiTable(false).supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES).build());
    });
    builder = new FlowPathBuilder(switchPropertiesRepository, kildaConfigurationRepository);
}
Also used : SwitchPropertiesRepository(org.openkilda.persistence.repositories.SwitchPropertiesRepository) Switch(org.openkilda.model.Switch) KildaConfigurationRepository(org.openkilda.persistence.repositories.KildaConfigurationRepository) SwitchRepository(org.openkilda.persistence.repositories.SwitchRepository) Before(org.junit.Before)

Aggregations

SwitchRepository (org.openkilda.persistence.repositories.SwitchRepository)6 Before (org.junit.Before)3 Switch (org.openkilda.model.Switch)3 Test (org.junit.Test)2 RepositoryFactory (org.openkilda.persistence.repositories.RepositoryFactory)2 HashMap (java.util.HashMap)1 Ignore (org.junit.Ignore)1 LinkPropsDto (org.openkilda.messaging.model.LinkPropsDto)1 NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)1 LinkPropsPut (org.openkilda.messaging.nbtopology.request.LinkPropsPut)1 LinkPropsResponse (org.openkilda.messaging.nbtopology.response.LinkPropsResponse)1 Isl (org.openkilda.model.Isl)1 MeterId (org.openkilda.model.MeterId)1 SwitchId (org.openkilda.model.SwitchId)1 SwitchStatus (org.openkilda.model.SwitchStatus)1 Cookie (org.openkilda.model.cookie.Cookie)1 FlowPathRepository (org.openkilda.persistence.repositories.FlowPathRepository)1 IslRepository (org.openkilda.persistence.repositories.IslRepository)1 KildaConfigurationRepository (org.openkilda.persistence.repositories.KildaConfigurationRepository)1 LagLogicalPortRepository (org.openkilda.persistence.repositories.LagLogicalPortRepository)1