summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java36
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java58
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponseTest.java41
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/HelloWorldTest.java42
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenRequestTest.java64
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenResponseTest.java51
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java27
-rw-r--r--ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/VlanTagTest.java18
-rw-r--r--ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/AllowedRangesTest.java50
10 files changed, 377 insertions, 12 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
index 6ec39ab5..b6f0f001 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
@@ -49,7 +49,7 @@ public class ConfigModelSearch implements Serializable {
@Column(name = "internal_version")
private Integer internalVersion;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "creation_date")
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java
new file mode 100644
index 00000000..d6a71e01
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelServiceTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2018 IBM.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.lang.System;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelContentRepository;
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelRepository;
+
+public class ConfigModelServiceTest {
+ private ConfigModelService configModelService;
+
+ @Test(expected = NullPointerException.class)
+ public void testGetInitialConfigModel() throws BluePrintException {
+ Assert.assertEquals(null, configModelService.getInitialConfigModel(""));
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java
new file mode 100644
index 00000000..a5eb661a
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2018 IBM.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.validator;
+
+import static org.junit.Assert.*;
+
+import org.junit.*;
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ModelTypeValidator;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class ModelTypeValidatorTest {
+
+ @Before
+ public void setup(){
+ ModelTypeValidator modelTypeValidator;
+ }
+
+ @Test
+ public void testGetValidModelDefinitionType_definitionContentNULL() throws Exception{
+ String definitionType=null;
+ JsonNode definitionContent=null;
+ boolean valid= ModelTypeValidator.validateModelTypeDefinition(definitionType, definitionContent);
+ Assert.assertTrue(valid);
+
+ }
+
+ @Test(expected=BluePrintException.class)
+ public void testvalidateModelType() throws Exception{
+ ModelType modelType = new ModelType();
+ modelType.setDefinitionType("");
+ modelType.setDerivedFrom("");
+ modelType.setDescription("");
+ JsonNode definitionContent=null;
+ modelType.setDefinition(definitionContent);
+ modelType.setModelName("");
+ modelType.setVersion("");
+ modelType.setTags("");
+ modelType.setUpdatedBy("");
+ ModelTypeValidator.validateModelType(modelType);
+ }
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponseTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponseTest.java
new file mode 100644
index 00000000..a833834f
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/GetConfigResponseTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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.ccsdk.apps.ms.neng.core.resource.model;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class GetConfigResponseTest {
+ private GetConfigResponse getConfigResponse;
+
+ @Before
+ public void setup() {
+ getConfigResponse = new GetConfigResponse();
+ }
+
+ @Test
+ public void TestGetSetConfigName() {
+ String obj = new String();
+ getConfigResponse.setResponse(obj);
+ Assert.assertEquals(obj, getConfigResponse.getResponse());
+ }
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/HelloWorldTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/HelloWorldTest.java
new file mode 100644
index 00000000..b09d6d60
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/HelloWorldTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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.ccsdk.apps.ms.neng.core.resource.model;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class HelloWorldTest {
+ private HelloWorld helloWorld;
+
+ @Test
+ public void TestGetSetMessage() {
+ helloWorld = new HelloWorld();
+ helloWorld.setMessage("new Message");
+ Assert.assertEquals("new Message", helloWorld.getMessage());
+ }
+
+ @Test
+ public void TestToString() {
+ helloWorld = new HelloWorld("new Message");
+ Assert.assertEquals("message = new Message", helloWorld.toString());
+ }
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenRequestTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenRequestTest.java
new file mode 100644
index 00000000..620208a1
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenRequestTest.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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.ccsdk.apps.ms.neng.core.resource.model;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class NameGenRequestTest {
+ private NameGenRequest nameGenRequest;
+
+ @Before
+ public void setup() {
+ nameGenRequest = new NameGenRequest();
+ }
+
+ @Test
+ public void TestGetSetElements() {
+ List<Map<String, String>> list = new ArrayList<Map<String, String>>();
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("el1", "el2");
+ list.add(map);
+ nameGenRequest.setElements(list);
+ Assert.assertEquals(list, nameGenRequest.getElements());
+ }
+
+ @Test
+ public void TestToStringFunction() {
+ List<Map<String, String>> list = new ArrayList<Map<String, String>>();
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("el1", "el2");
+ list.add(map);
+ nameGenRequest.setElements(list);
+ Assert.assertEquals("elements: [{el1=el2}]", nameGenRequest.toString());
+ }
+
+ @Test
+ public void TestGetSetUseDb() {
+ nameGenRequest.setUseDb(true);
+ Assert.assertTrue(nameGenRequest.getUseDb());
+ }
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenResponseTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenResponseTest.java
new file mode 100644
index 00000000..f1a73199
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/resource/model/NameGenResponseTest.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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.ccsdk.apps.ms.neng.core.resource.model;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class NameGenResponseTest {
+ private NameGenResponse nameGenResponse;
+
+ @Before
+ public void setup() {
+ nameGenResponse = new NameGenResponse();
+ }
+
+ @Test
+ public void TestGetSetElements() {
+ List<Map<String, String>> list = new ArrayList<Map<String, String>>();
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("el1", "el2");
+ list.add(map);
+ nameGenResponse.setElements(list);
+ Assert.assertEquals(list, nameGenResponse.getElements());
+ }
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java
index 4dc4fa7c..77ec7eeb 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/PolicyFinderServiceImplTest.java
@@ -22,17 +22,7 @@
package org.onap.ccsdk.apps.ms.neng.service.extinf.impl;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
import com.fasterxml.jackson.databind.ObjectMapper;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -49,8 +39,18 @@ import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
@RunWith(MockitoJUnitRunner.class)
public class PolicyFinderServiceImplTest {
@InjectMocks
@@ -78,6 +78,13 @@ public class PolicyFinderServiceImplTest {
}
@SuppressWarnings("unchecked")
+ @Test(expected = NengException.class)
+ public void testHandleError_NOT_FOUND() throws Exception{
+ HttpStatusCodeException e = new HttpClientErrorException(HttpStatus.NOT_FOUND,"",null,StandardCharsets.US_ASCII);
+ policyFinder.handleError(e);
+
+ }
+ @SuppressWarnings("unchecked")
@Test
public void testmakeOutboundCall() throws Exception {
Map<String, Object> configMap = buildPolicyResponse();
diff --git a/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/VlanTagTest.java b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/VlanTagTest.java
index dafc89a1..314b12a2 100644
--- a/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/VlanTagTest.java
+++ b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlangtagapi/core/model/VlanTagTest.java
@@ -56,6 +56,22 @@ public class VlanTagTest {
assertTrue(vlanTag.equals(vlanTag1));
assertTrue((Integer)vlanTag.hashCode() instanceof Integer);
}
-
+
+ @Test
+ public void testElementVlanRole() {
+ vlanTag.setElementVlanRole("role");
+ assertEquals("role", vlanTag.getElementVlanRole());
+ }
+
+ @Test
+ public void testToString() {
+ String value = vlanTag.toString();
+ assertEquals("class VlanTag {\n" +
+ " vlanUuid: null\n" +
+ " vlantagName: null\n" +
+ " vlantagValue: null\n" +
+ " elementVlanRole: null\n" +
+ "}", value);
+ }
}
diff --git a/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/AllowedRangesTest.java b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/AllowedRangesTest.java
new file mode 100644
index 00000000..9cb004c5
--- /dev/null
+++ b/ms/vlantag-api/src/test/java/org/onap/ccsdk/apps/ms/vlantagapi/core/extinf/pm/model/AllowedRangesTest.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright © 2018 IBM.
+ *
+ * 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.
+ ******************************************************************************
+*/
+package org.onap.ccsdk.apps.ms.vlantagapi.core.extinf.pm.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AllowedRangesTest {
+ private AllowedRanges allowedRanges;
+
+ @Before
+ public void setUp() {
+ allowedRanges = new AllowedRanges();
+ }
+
+ @Test
+ public void testGetSEtMin() {
+ allowedRanges.setMin("10");
+ assertEquals("10", allowedRanges.getMin());
+ }
+
+ @Test
+ public void testGetSEtMax() {
+ allowedRanges.setMax("20");
+ assertEquals("20", allowedRanges.getMax());
+ }
+
+ @Test
+ public void testToStirng() {
+ allowedRanges.setMax("20");
+ allowedRanges.setMin("10");
+ assertEquals("AllowedRanges [min=10, max=20]", allowedRanges.toString());
+ }
+}