aboutsummaryrefslogtreecommitdiffstats
path: root/ms/neng/src
diff options
context:
space:
mode:
Diffstat (limited to 'ms/neng/src')
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java14
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParser.java3
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImpl.java6
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java44
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java14
5 files changed, 75 insertions, 6 deletions
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java
index 6efa94de..0edc38a3 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/Application.java
@@ -21,6 +21,9 @@
package org.onap.ccsdk.apps.ms.neng.core;
import java.util.Arrays;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -38,6 +41,9 @@ import org.springframework.scheduling.annotation.EnableAsync;
@ComponentScan(basePackages = "org.onap.ccsdk")
@EnableAsync
public class Application extends SpringBootServletInitializer {
+
+ private Logger logger = LoggerFactory.getLogger(Application.class);
+
/**
* Configures the application.
*/
@@ -49,7 +55,7 @@ public class Application extends SpringBootServletInitializer {
/**
* Entry point for the application.
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@@ -59,14 +65,14 @@ public class Application extends SpringBootServletInitializer {
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
- System.out.println("################################");
- System.out.println("Inspecting the beans provided by Spring Boot:");
+ logger.info("################################");
+ logger.info("Inspecting the beans provided by Spring Boot:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
- System.out.println("################################");
+ logger.info("################################");
};
}
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParser.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParser.java
index d9eda66a..e808b8c2 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParser.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/RecipeParser.java
@@ -37,6 +37,9 @@ public class RecipeParser {
* @return a list containing the items in the recipe
* @throws Exception all exceptions are propagated
*/
+ private RecipeParser(){
+
+ }
public static List<String> parseRecipe(PolicyParameters policyParams, String recipe) throws Exception {
String separatorAll = policyParams.getRecipeSeparator();
if (separatorAll == null) {
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImpl.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImpl.java
index 6c4ae889..7356c3bd 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImpl.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications 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
@@ -125,4 +127,8 @@ public class AaiServiceImpl {
}
return this.restTemplate;
}
+
+ public void setAaiProps(AaiProps aaiProps) {
+ this.aaiProps = aaiProps;
+ }
}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java
new file mode 100644
index 00000000..7c6c95f3
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/validator/ExternalKeyValidatorTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM. 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.ccsdk.apps.ms.neng.core.validator;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.ccsdk.apps.ms.neng.persistence.repository.GeneratedNameRespository;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExternalKeyValidatorTest {
+
+ @InjectMocks
+ ExternalKeyValidator externalKeyValidator;
+
+ @Mock
+ GeneratedNameRespository genNameRepo;
+
+ @Test
+ public void testIsPresent()
+ {
+ externalKeyValidator.isPresent("testId");
+ }
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java
index b25de210..8507bf65 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java
@@ -4,8 +4,6 @@
* ================================================================================
* Copyright (C) 2018 IBM.
* ================================================================================
- * Modifications 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
@@ -26,7 +24,9 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.apps.ms.neng.core.resource.model.AaiResponse;
+import org.onap.ccsdk.apps.ms.neng.extinf.props.AaiProps;
import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.web.client.RestTemplate;
public class AaiServiceImplTest {
private AaiServiceImpl aaiServiceImpl;
@@ -48,4 +48,14 @@ public class AaiServiceImplTest {
AaiResponse aaiResponse = aaiServiceImpl.buildResponse(true);
Assert.assertEquals(aaiResponse.isRecFound(), true);
}
+
+ @Test(expected= Exception.class)
+ public void testValidate() throws Exception {
+ AaiProps aaiProps=new AaiProps();
+ aaiProps.setUriBase("http://");
+ aaiServiceImpl.setAaiProps(aaiProps);
+ aaiServiceImpl.setRestTemplate(new RestTemplate());
+ aaiServiceImpl.validate("testUrl/","testName");
+
+ }
}