X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Fclamp%2Floop%2FLoopControllerTestItCase.java;h=4d51bb27c8db252cba36566b0e132f04c36e0d7e;hb=723de7f63f0951d0cfe7a23956cf9d00128809b1;hp=24a9037ad9964183397d144096bc2b21e177b877;hpb=774b4ba65f0d23ae34d3bddb63058796121c1ae3;p=clamp.git diff --git a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java index 24a9037a..4d51bb27 100644 --- a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java +++ b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java @@ -30,6 +30,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import java.io.IOException; import java.util.Set; import javax.transaction.Transactional; import org.junit.Test; @@ -46,7 +47,6 @@ import org.onap.clamp.policy.operational.OperationalPolicy; import org.onap.clamp.policy.operational.OperationalPolicyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.annotation.Commit; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -77,10 +77,10 @@ public class LoopControllerTestItCase { private void saveTestLoopToDb() { Loop testLoop = createTestLoop(EXAMPLE_LOOP_NAME, "blueprint", "representation"); testLoop.setGlobalPropertiesJson(JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class)); - LoopTemplate template = new LoopTemplate(); + LoopTemplate template = new LoopTemplate(); template.setName("testTemplate"); testLoop.setLoopTemplate(template); - Service modelService = new Service("{\"name\":\"serviceName\",\"UUID\":\"uuid\"}","{}"); + Service modelService = new Service("{\"name\":\"serviceName\",\"UUID\":\"uuid\"}", "{}"); testLoop.setModelService(modelService); loopService.saveOrUpdateLoop(testLoop); } @@ -140,7 +140,7 @@ public class LoopControllerTestItCase { public void testUpdateMicroservicePolicy() { saveTestLoopToDb(); PolicyModel policyModel = new PolicyModel("testPolicyModel", - "tosca_definitions_version: tosca_simple_yaml_1_0_0","1.0.0"); + "tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0"); policyModelsService.saveOrUpdatePolicyModel(policyModel); MicroServicePolicy policy = new MicroServicePolicy("policyName", policyModel, false, JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null, null, null); @@ -158,10 +158,10 @@ public class LoopControllerTestItCase { @Test @Transactional - public void testAddAndRemoveOperationalPolicies() { + public void testAddAndRemoveOperationalPolicies() throws IOException { saveTestLoopToDb(); PolicyModel policyModel = new PolicyModel("testPolicyModel", - "tosca_definitions_version: tosca_simple_yaml_1_0_0","1.0.0"); + null, "1.0.0"); policyModelsService.saveOrUpdatePolicyModel(policyModel); loopController.addOperationalPolicy(EXAMPLE_LOOP_NAME, "testPolicyModel", "1.0.0"); @@ -169,7 +169,7 @@ public class LoopControllerTestItCase { Loop newLoop = loopController.getLoop(EXAMPLE_LOOP_NAME); Set opPolicyList = newLoop.getOperationalPolicies(); assertThat(opPolicyList.size()).isEqualTo(1); - for(OperationalPolicy policy : opPolicyList) { + for (OperationalPolicy policy : opPolicyList) { assertThat(policy.getName().contains("OPERATIONAL_serviceName")).isTrue(); assertThat(policy.getPolicyModel().getPolicyModelType()).isEqualTo("testPolicyModel"); assertThat(policy.getPolicyModel().getVersion()).isEqualTo("1.0.0");