summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorXue Gao <xg353y@intl.att.com>2019-06-18 12:43:58 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-18 12:43:58 +0000
commit87dd6b9a1680c31a736164b29e2b663a27fbe2a7 (patch)
treee3fcddfb6126c80eca2cc9b3b70c8e1c3283ca65 /src/test/java
parenteb216ac66f47c2b9d2b69a6e080d3969f75d78af (diff)
parentbd60a90dedf1dbc0052b6e1a1d20010640cc15a0 (diff)
Merge "Fixed Checkstyle issues"
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java10
-rw-r--r--src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java3
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java28
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java3
-rw-r--r--src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java19
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java6
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java6
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java12
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java12
10 files changed, 68 insertions, 35 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java b/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
index c92cdcf35..429611ce6 100644
--- a/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
@@ -101,7 +101,7 @@ public class TcaRequestFormatterTest {
}
@Test(expected = TcaRequestFormatterException.class)
- public void shouldThrowTcaRequestFormatterException() throws IOException{
+ public void shouldThrowTcaRequestFormatterException() throws IOException {
//given
String service = "TestService";
String policy = "TestService_scope.PolicyName";
@@ -113,4 +113,4 @@ public class TcaRequestFormatterTest {
//then
TcaRequestFormatter.createPolicyContent(clampProperties, modelProperties, service, policy, tca);
}
-} \ No newline at end of file
+}
diff --git a/src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java b/src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java
index 4c23eca09..69277baf9 100644
--- a/src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java
@@ -127,21 +127,21 @@ public class HttpConnectionManagerItCase {
@Test(expected = BadRequestException.class)
public void testHttpsGet404() throws IOException {
- httpConnectionManager.doHttpRequest("https://localhost:" + this.httpsPort + "/designer/index1.html",
- "GET", null, null, "DCAE", null, null);
+ httpConnectionManager.doHttpRequest("https://localhost:" + this.httpsPort + "/designer/index1.html", "GET",
+ null, null, "DCAE", null, null);
fail("Should have raised an BadRequestException");
}
@Test(expected = BadRequestException.class)
public void testHttpsPost404() throws IOException {
- httpConnectionManager.doHttpRequest("https://localhost:" + this.httpsPort + "/designer/index1.html",
- "POST", "", "application/json", "DCAE", null, null);
+ httpConnectionManager.doHttpRequest("https://localhost:" + this.httpsPort + "/designer/index1.html", "POST",
+ "", "application/json", "DCAE", null, null);
fail("Should have raised an BadRequestException");
}
@Test(expected = BadRequestException.class)
public void testHttpException() throws IOException {
- httpConnectionManager.doHttpRequest("http://localhost:" + this.httpsPort + "/designer/index.html", "GET",
+ httpConnectionManager.doHttpRequest("http://localhost:" + this.httpsPort + "/designer/index.html", "GET",
null, null, "DCAE", null, null);
fail("Should have raised an BadRequestException");
}
diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
index 0a05d65dc..d34042038 100644
--- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
@@ -101,7 +101,8 @@ public class CldsReferencePropertiesItCase {
*/
@Test
public void testGetFileContent() throws IOException {
- String location = "{\n\t\"DC1\": \"Data Center 1\",\n\t\"DC2\": \"Data Center 2\",\n\t\"DC3\": \"Data Center 3\"\n}\n";
+ String location = "{\n\t\"DC1\": \"Data Center 1\","
+ + "\n\t\"DC2\": \"Data Center 2\",\n\t\"DC3\": \"Data Center 3\"\n}\n";
String content = refProp.getFileContent("ui.location.default");
assertEquals(location, content);
// Test composite key
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
index dec639770..dcaf2b952 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2019 Nokia Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -20,6 +22,7 @@
* ===================================================================
*
*/
+
package org.onap.clamp.clds.sdc.controller.installer;
import com.google.gson.Gson;
@@ -60,6 +63,12 @@ public class BlueprintParserTest {
private static JsonObject jsonObjectBlueprintWithoutProperties;
private static JsonObject jsonObjectBlueprintWithoutRelationships;
+ /**
+ * Method to load Blueprints before all test.
+ *
+ * @throws IOException
+ * In case of issues when opening the files
+ */
@BeforeClass
public static void loadBlueprints() throws IOException {
microServiceTheWholeBlueprintValid = ResourceFileUtil
@@ -73,12 +82,13 @@ public class BlueprintParserTest {
.getResourceAsString("clds/single-microservice-fragment-without-name.yaml");
String microServiceBlueprintWithoutProperties = ResourceFileUtil
.getResourceAsString("clds/single-microservice-fragment-without-properties.yaml");
- String microServiceBlueprintWithoutRelationships = ResourceFileUtil
- .getResourceAsString("clds/single-microservice-fragment-without-relationships.yaml");
jsonObjectBlueprintValid = yamlToJson(microServiceBlueprintValid);
jsonObjectBlueprintWithoutName = yamlToJson(microServiceBlueprintWithoutName);
jsonObjectBlueprintWithoutProperties = yamlToJson(microServiceBlueprintWithoutProperties);
+
+ String microServiceBlueprintWithoutRelationships = ResourceFileUtil
+ .getResourceAsString("clds/single-microservice-fragment-without-relationships.yaml");
jsonObjectBlueprintWithoutRelationships = yamlToJson(microServiceBlueprintWithoutRelationships);
}
@@ -162,11 +172,11 @@ public class BlueprintParserTest {
}
@Test
- public void fallBackToOneMicroServiceTCATest() {
- MicroService tcaMS = new MicroService(BlueprintParser.TCA, "onap.policies.monitoring.cdap.tca.hi.lo.app", "",
- "");
- List<MicroService> expected = Collections.singletonList(tcaMS);
+ public void fallBackToOneMicroServiceTcaTest() {
+ MicroService tcaMs = new MicroService(BlueprintParser.TCA,
+ "onap.policies.monitoring.cdap.tca.hi.lo.app", "", "");
+ List<MicroService> expected = Collections.singletonList(tcaMs);
List<MicroService> actual = new BlueprintParser().fallbackToOneMicroService(microServiceBlueprintOldStyleTCA);
Assert.assertEquals(expected, actual);
@@ -174,10 +184,10 @@ public class BlueprintParserTest {
@Test
public void fallBackToOneMicroServiceHolmesTest() {
- MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "", "");
+ MicroService holmesMs = new MicroService(BlueprintParser.HOLMES,
+ "onap.policies.monitoring.cdap.tca.hi.lo.app", "", "");
- List<MicroService> expected = Collections.singletonList(holmesMS);
+ List<MicroService> expected = Collections.singletonList(holmesMs);
List<MicroService> actual = new BlueprintParser()
.fallbackToOneMicroService(microServiceBlueprintOldStyleHolmes);
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
index 4b41ee818..4b4563cd4 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
@@ -20,6 +20,7 @@
* ===================================================================
*
*/
+
package org.onap.clamp.clds.sdc.controller.installer;
import java.util.Arrays;
@@ -73,4 +74,4 @@ public class ChainGeneratorTest {
List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
Assert.assertTrue(actualList.isEmpty());
}
-} \ No newline at end of file
+}
diff --git a/src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java b/src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java
index 4351a80d4..a34ef3f94 100644
--- a/src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/XmlToolsTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2019 Nokia. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -54,7 +56,20 @@ public class XmlToolsTest {
Assert.assertNull(doc.getDoctype());
}
-
+ /**
+ * Method to parse String into XmlDocument.
+ *
+ * @param res
+ * String to parse
+ * @return
+ * XmlDocument
+ * @throws ParserConfigurationException
+ * In case of issues with parse the document
+ * @throws SAXException
+ * In case of bad format of res
+ * @throws IOException
+ * In case of issues creating the document
+ */
public static Document parseStringToXmlDocument(String res)
throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -69,4 +84,4 @@ public class XmlToolsTest {
return db.parse(is);
}
-} \ No newline at end of file
+}
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
index ff6e1b5d4..269ad42e1 100644
--- a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2019 Nokia. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -60,7 +62,7 @@ public class ClampGraphBuilderTest {
MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id");
String policy = "OperationalPolicy";
- List<MicroService> microServices = Arrays.asList(ms1, ms2);
+ final List<MicroService> microServices = Arrays.asList(ms1, ms2);
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).policy(policy).build();
@@ -91,4 +93,4 @@ public class ClampGraphBuilderTest {
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
clampGraphBuilder.collector(collector).policy(policy).build();
}
-} \ No newline at end of file
+}
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java
index 6bbebdfde..e46db1a2d 100644
--- a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphTest.java
@@ -46,7 +46,7 @@ public class ClampGraphTest {
private DocumentBuilder mockDocumentBuilder;
@Test
- public void getAsSVGTest() throws IOException, ParserConfigurationException, SAXException {
+ public void getAsSvgTest() throws IOException, ParserConfigurationException, SAXException {
String expected = ResourceFileUtil.getResourceAsString("clds/util/file.xml");
Document document = XmlToolsTest.parseStringToXmlDocument(expected);
@@ -57,7 +57,7 @@ public class ClampGraphTest {
}
@Test
- public void getAsSVGLazyTest() throws IOException, ParserConfigurationException, SAXException {
+ public void getAsSvgLazyTest() throws IOException, ParserConfigurationException, SAXException {
String expected = ResourceFileUtil.getResourceAsString("clds/util/file.xml");
Document document = XmlToolsTest.parseStringToXmlDocument(expected);
@@ -74,4 +74,4 @@ public class ClampGraphTest {
Assert.assertEquals(expected.trim(), actualSecond.trim());
}
-} \ No newline at end of file
+}
diff --git a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
index 9a82ec097..78e0d2e3d 100644
--- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
@@ -5,7 +5,9 @@
* Copyright (C) 2019 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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
*
@@ -85,10 +87,10 @@ public class LoopRepositoriesItCase {
private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation,
String policyTosca, String jsonProperties, boolean shared) {
- MicroServicePolicy µService = new MicroServicePolicy(name, modelType, policyTosca, shared,
+ MicroServicePolicy microService = new MicroServicePolicy(name, modelType, policyTosca, shared,
gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
- µService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
- return µService;
+ microService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
+ return microService;
}
private LoopLog getLoopLog(LogType type, String message, Loop loop) {
@@ -97,7 +99,7 @@ public class LoopRepositoriesItCase {
@Test
@Transactional
- public void CrudTest() {
+ public void crudTest() {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
"123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest");
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index 8899a36c7..c9350c610 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -5,7 +5,9 @@
* Copyright (C) 2019 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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
*
@@ -64,11 +66,11 @@ public class LoopToJsonTest {
private MicroServicePolicy getMicroServicePolicy(String name, String modelType, String jsonRepresentation,
String policyTosca, String jsonProperties, boolean shared) {
- MicroServicePolicy µService = new MicroServicePolicy(name, modelType, policyTosca, shared,
+ MicroServicePolicy microService = new MicroServicePolicy(name, modelType, policyTosca, shared,
gson.fromJson(jsonRepresentation, JsonObject.class), new HashSet<>());
- µService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
+ microService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
- return µService;
+ return microService;
}
private LoopLog getLoopLog(LogType type, String message, Loop loop) {
@@ -78,7 +80,7 @@ public class LoopToJsonTest {
}
@Test
- public void LoopGsonTest() throws IOException {
+ public void loopGsonTest() throws IOException {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
"123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy(