aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-06-06 13:47:21 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-06-06 14:22:52 +0200
commit7a58af870eb9934dfec4b5353672d7c428208116 (patch)
tree67763a011cbc4c0f94405864dd19f2fd7f07b839 /src/test
parent6b6521b5824f61dea05f400dba41092f3aaa0697 (diff)
Minor Improvement
Code rework postponed to Casablanca to not impact Bejing release + Update version to 3.0.0 Issue-ID: CLAMP-177 Change-Id: I3e2cb22c1158df0cf5d4cf8369f9c469004d68c0 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsHealthcheckServiceItCase.java58
-rw-r--r--src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/model/CldsModelTest.java17
-rw-r--r--src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java15
-rw-r--r--src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java13
-rw-r--r--src/test/resources/clds/key.properties1
6 files changed, 73 insertions, 35 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsHealthcheckServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsHealthcheckServiceItCase.java
new file mode 100644
index 00000000..40e87688
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/it/CldsHealthcheckServiceItCase.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ */
+
+package org.onap.clamp.clds.it;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.clamp.clds.model.CldsHealthCheck;
+import org.onap.clamp.clds.service.CldsHealthcheckService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * Tests HealthCheck Service.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+public class CldsHealthcheckServiceItCase {
+
+ @Autowired
+ private CldsHealthcheckService cldsHealthcheckService;
+
+ @Test
+ public void testGetHealthCheck() {
+ Response response = cldsHealthcheckService.gethealthcheck();
+ CldsHealthCheck cldsHealthCheck = (CldsHealthCheck) response.getEntity();
+ assertNotNull(cldsHealthCheck);
+ assertEquals("UP", cldsHealthCheck.getHealthCheckStatus());
+ assertEquals("CLDS-APP", cldsHealthCheck.getHealthCheckComponent());
+ assertEquals("OK", cldsHealthCheck.getDescription());
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java
index ba3df843..b6f3ef42 100644
--- a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java
@@ -73,10 +73,10 @@ public class OperationPolicyReqItCase {
assertTrue(attributes.size() == 2);
// now validate the Yaml, to do so we replace the dynamic ID by a known
// key so that we can compare it
- String yaml = URLDecoder.decode(attributes.get(0).get(AttributeType.RULE).get("ControlLoopYaml"), "UTF-8");
+ String yaml = URLDecoder.decode(attributes.get(0).get(AttributeType.RULE).get("controlLoopYaml"), "UTF-8");
yaml = replaceGeneratedValues(yaml);
assertEquals(ResourceFileUtil.getResourceAsString("example/operational-policy/yaml-policy-chain-1.yaml"), yaml);
- yaml = URLDecoder.decode(attributes.get(1).get(AttributeType.RULE).get("ControlLoopYaml"), "UTF-8");
+ yaml = URLDecoder.decode(attributes.get(1).get(AttributeType.RULE).get("controlLoopYaml"), "UTF-8");
yaml = replaceGeneratedValues(yaml);
assertEquals(ResourceFileUtil.getResourceAsString("example/operational-policy/yaml-policy-chain-2.yaml"), yaml);
}
diff --git a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
index 82c668c2..6ebdc4bb 100644
--- a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
@@ -146,23 +146,6 @@ public class CldsModelTest {
}
@Test(expected = IllegalArgumentException.class)
- public void testValidateActionFromDelete() {
- CldsModel cldsModel = new CldsModel();
- cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DELETE);
- cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_CREATE);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
- System.out.println("Exception caught IllegalArgumentException as expected");
- }
- cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DELETE);
- cldsModel.getEvent().setActionStateCd(CldsEvent.ACTION_STATE_SENT);
- cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
- fail("Exception should have been sent");
- }
-
- @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromStop() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_STOP);
diff --git a/src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java b/src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java
index 87409644..96784dd6 100644
--- a/src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java
+++ b/src/test/java/org/onap/clamp/clds/swagger/SwaggerConfig.java
@@ -23,24 +23,17 @@
package org.onap.clamp.clds.swagger;
import org.springframework.context.annotation.Configuration;
+
import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.service.*;
-import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.service.ApiInfo;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-
-
@EnableSwagger2
@Configuration
public class SwaggerConfig {
private ApiInfo apiInfo() {
- return new ApiInfoBuilder()
- .title("Clamp")
- .description("Clamp API Description")
- .license("Apache 2.0")
- .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
- .build();
+ return new ApiInfoBuilder().title("Clamp").description("Clamp API Description").license("Apache 2.0")
+ .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0").build();
}
}
diff --git a/src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java b/src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java
index a4691b16..363d12d4 100644
--- a/src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java
+++ b/src/test/java/org/onap/clamp/clds/swagger/SwaggerGenerationTest.java
@@ -19,19 +19,24 @@
* ============LICENSE_END============================================
* ===================================================================
*/
+
package org.onap.clamp.clds.swagger;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.clamp.clds.Application;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+
import io.github.swagger2markup.Swagger2MarkupConverter;
-import org.onap.clamp.clds.Application;
@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = {Application.class, SwaggerConfig.class})
+@SpringBootTest(classes = {
+ Application.class, SwaggerConfig.class
+})
public class SwaggerGenerationTest {
@Test
diff --git a/src/test/resources/clds/key.properties b/src/test/resources/clds/key.properties
deleted file mode 100644
index dda81104..00000000
--- a/src/test/resources/clds/key.properties
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.clamp.encryption.aes.key=aa3871669d893c7fb8abbcda31b88b4f \ No newline at end of file