use of org.openkilda.persistence.repositories.LagLogicalPortRepository in project open-kilda by telstra.
the class SwitchValidateServiceImplTest method setUp.
@Before
public void setUp() {
RepositoryFactory repositoryFactory = Mockito.mock(RepositoryFactory.class);
FlowPathRepository flowPathRepository = Mockito.mock(FlowPathRepository.class);
SwitchRepository switchRepository = Mockito.mock(SwitchRepository.class);
when(switchRepository.findById(eq(SWITCH_ID))).thenReturn(Optional.of(SWITCH_1));
when(switchRepository.findById(eq(SWITCH_ID_MISSING))).thenReturn(Optional.empty());
LagLogicalPortRepository lagLogicalPortRepository = Mockito.mock(LagLogicalPortRepository.class);
when(repositoryFactory.createFlowPathRepository()).thenReturn(flowPathRepository);
when(repositoryFactory.createSwitchRepository()).thenReturn(switchRepository);
when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory);
service = new SwitchValidateServiceImpl(carrier, persistenceManager, validationService, ruleManager);
request = SwitchValidateRequest.builder().switchId(SWITCH_ID).processMeters(true).build();
flowSpeakerData = FlowSpeakerData.builder().ofVersion(OfVersion.OF_13).cookie(new Cookie(1L)).table(OfTable.INPUT).priority(10).match(emptySet()).instructions(Instructions.builder().build()).flags(emptySet()).build();
meterSpeakerData = MeterSpeakerData.builder().meterId(new MeterId(32)).rate(10000).burst(10500).ofVersion(OfVersion.OF_13).flags(Sets.newHashSet(MeterFlag.KBPS, MeterFlag.BURST, MeterFlag.STATS)).build();
when(validationService.validateRules(any(), any(), any())).thenReturn(new ValidateRulesResult(newHashSet(flowSpeakerData.getCookie().getValue()), emptySet(), emptySet(), emptySet()));
when(validationService.validateMeters(any(), any(), any())).thenReturn(new ValidateMetersResult(emptyList(), emptyList(), emptyList(), emptyList()));
}
Aggregations