aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-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
5 files changed, 73 insertions, 34 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 000000000..40e876880
--- /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 ba3df843f..b6f3ef423 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 82c668c2a..6ebdc4bbf 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 87409644d..96784dd64 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 a4691b164..363d12d40 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