+ Assert.assertNull(result);
+
+ }
+
+ @Test
+ public void getServiceFromEmptyDataStoreShouldBeEmpty() {
+ Optional<Services> optService = this.serviceDataStoreOperations.getService("service 1");
+ Assert.assertFalse(optService.isPresent());
+ }
+
+ @Test
+ public void createServiceShouldBeSuccessForValidInput() {
+ ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
+ OperationResult result = this.serviceDataStoreOperations.createService(createInput);
+ Assert.assertTrue(result.isSuccess());
+ }
+
+ @Test
+ public void getServiceShouldReturnTheCorrectServiceForTheCreatedService() {
+ ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
+ this.serviceDataStoreOperations.createService(createInput);
+
+ Optional<Services> optService = this.serviceDataStoreOperations.getService(createInput.getServiceName());
+ Assert.assertTrue(optService.isPresent());
+ Assert.assertEquals(createInput.getServiceName(), optService.get().getServiceName());
+ }
+
+ @Test
+ public void deleteServiceShouldBeSuccessfulForDeletingService() {
+ ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
+ this.serviceDataStoreOperations.createService(createInput);
+ OperationResult result = this.serviceDataStoreOperations.deleteService(createInput.getServiceName());
+ Assert.assertTrue(result.isSuccess());
+ }
+
+// @Test
+// public void deleteServiceShouldBeFailedIfServiceDoNotExists() {
+// OperationResult result = this.serviceDataStoreOperations.deleteService("Any service");
+// Assert.assertFalse(result.isSuccess());
+// }
+
+ @Test
+ public void modifyServiceIsSuccessfulForPresentService() {
+ ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
+ this.serviceDataStoreOperations.createService(createInput);
+ OperationResult result = this.serviceDataStoreOperations.modifyService(createInput.getServiceName(),
+ State.InService, State.InService);
+ Assert.assertTrue(result.isSuccess());
+ }
+
+ @Test
+ public void getTempServiceFromEmptyDataStoreShouldBeEmpty() {
+ Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp.service.list
+ .Services> optService = this.serviceDataStoreOperations.getTempService("service 1");
+ Assert.assertFalse(optService.isPresent());
+ }
+
+ @Test
+ public void createTempServiceShouldBeSuccessForValidInput() {
+ TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
+ OperationResult result = this.serviceDataStoreOperations.createTempService(createInput);
+ Assert.assertTrue(result.isSuccess());
+ }
+
+ @Test
+ public void getTempServiceShouldReturnTheCorrectTempServiceForTheCreatedService() {
+ TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
+ this.serviceDataStoreOperations.createTempService(createInput);
+
+ Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp.service.list
+ .Services> optService = this.serviceDataStoreOperations.getTempService(createInput.getCommonId());
+ Assert.assertTrue(optService.isPresent());
+ Assert.assertEquals(createInput.getCommonId(), optService.get().getCommonId());
+ }
+
+ @Test
+ public void deleteTempServiceShouldBeSuccessfulForDeletingTempService() {
+ TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
+ this.serviceDataStoreOperations.createTempService(createInput);
+ OperationResult result = this.serviceDataStoreOperations.deleteTempService(createInput.getCommonId());
+ Assert.assertTrue(result.isSuccess());
+ }
+
+ @Test
+ public void modifyTempServiceIsSuccessfulForPresentTempService() {
+ TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
+ this.serviceDataStoreOperations.createTempService(createInput);
+ OperationResult result = this.serviceDataStoreOperations.modifyTempService(createInput.getCommonId(),
+ State.InService, State.InService);
+ Assert.assertTrue(result.isSuccess());
+ }
+
+ @Test
+ public void createServicePathShouldBeSuccessfulForValidInput() {
+ ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
+ this.serviceDataStoreOperations.createService(createInput);
+ ServiceInput serviceInput = new ServiceInput(createInput);
+ ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
+ .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
+ ResponseParameters responseParameters = new ResponseParametersBuilder()
+ .setPathDescription(new PathDescriptionBuilder()
+ .setAToZDirection(new AToZDirectionBuilder().setAToZWavelengthNumber(1L).setRate(1L).build())
+ .setZToADirection(new ZToADirectionBuilder().setZToAWavelengthNumber(1L).setRate(1L).build()).build())
+ .build();
+ PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon).setResponseParameters(responseParameters)
+ .build();
+ OperationResult result =
+ this.serviceDataStoreOperations.createServicePath(serviceInput, pathComputationRequestOutput);
+ Assert.assertTrue(result.isSuccess());
+ }
+
+ @Test
+ public void createServicePathShouldFailForInvalidInput() {
+ ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
+ this.serviceDataStoreOperations.createService(createInput);
+ ServiceInput serviceInput = new ServiceInput(createInput);
+ ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
+ .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
+ ResponseParameters responseParameters = new ResponseParametersBuilder().build();
+ PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon).setResponseParameters(responseParameters)
+ .build();
+ OperationResult result =
+ this.serviceDataStoreOperations.createServicePath(serviceInput, pathComputationRequestOutput);
+ Assert.assertFalse(result.isSuccess());
+ }
+
+ @Test
+ public void deleteServicePathShouldBeSuccessForDeletingServicePath() {
+ ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
+ this.serviceDataStoreOperations.createService(createInput);
+ ServiceInput serviceInput = new ServiceInput(createInput);
+ ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
+ .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
+ ResponseParameters responseParameters = new ResponseParametersBuilder()
+ .setPathDescription(new PathDescriptionBuilder()
+ .setAToZDirection(new AToZDirectionBuilder().setAToZWavelengthNumber(1L).setRate(1L).build())
+ .setZToADirection(new ZToADirectionBuilder().setZToAWavelengthNumber(1L).setRate(1L).build()).build())
+ .build();
+ PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon).setResponseParameters(responseParameters)
+ .build();
+ this.serviceDataStoreOperations.createServicePath(serviceInput, pathComputationRequestOutput);