Use 1.15.5 aai-common release 31/140131/4
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Tue, 4 Feb 2025 07:07:50 +0000 (08:07 +0100)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Tue, 4 Feb 2025 10:00:36 +0000 (11:00 +0100)
Issue-ID: AAI-4119
Change-Id: I392037529a8e377cf319981772255d417addac6f
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
79 files changed:
pom.xml
src/main/java/org/onap/aai/GraphAdminApp.java
src/main/java/org/onap/aai/config/AuthProperties.java [moved from src/main/java/org/onap/aai/config/JettyPasswordDecoder.java with 65% similarity]
src/main/java/org/onap/aai/config/PasswordDecoder.java [deleted file]
src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java [deleted file]
src/main/java/org/onap/aai/config/SecurityConfig.java [new file with mode: 0644]
src/main/java/org/onap/aai/datagrooming/DataGrooming.java
src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java
src/main/java/org/onap/aai/datasnapshot/DataSnapshotTasks.java
src/main/java/org/onap/aai/datasnapshot/PartialPropAndEdgeLoader.java
src/main/java/org/onap/aai/db/schema/ScriptDriver.java
src/main/java/org/onap/aai/dbgen/DupeTool.java
src/main/java/org/onap/aai/dbgen/DynamicPayloadGenerator.java
src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod.java
src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod4Hist.java
src/main/java/org/onap/aai/dbgen/schemamod/SchemaModInternalBatch.java
src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java
src/main/java/org/onap/aai/historytruncate/HistoryTruncateTasks.java
src/main/java/org/onap/aai/interceptors/pre/OneWaySslAuthorization.java [deleted file]
src/main/java/org/onap/aai/migration/MigrationController.java
src/main/java/org/onap/aai/migration/v12/EdgeReportForToscaMigration.java
src/main/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfiguration.java
src/main/java/org/onap/aai/migration/v12/MigrateINVEvcInventory.java
src/main/java/org/onap/aai/migration/v12/MigrateSAREvcInventory.java
src/main/java/org/onap/aai/migration/v12/SDWANSpeedChangeMigration.java
src/main/java/org/onap/aai/migration/v12/UpdateAaiUriIndexMigration.java
src/main/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOne.java
src/main/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPserverData.java
src/main/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruth.java
src/main/java/org/onap/aai/rest/client/ApertureService.java
src/main/java/org/onap/aai/rest/client/ApertureServiceOneWayClient.java
src/main/java/org/onap/aai/rest/client/ApertureServiceRestClient.java
src/main/java/org/onap/aai/schema/GenTester.java
src/main/java/org/onap/aai/schema/GenTester4Hist.java
src/main/java/org/onap/aai/service/AuthorizationService.java [deleted file]
src/main/java/org/onap/aai/util/SendDeleteMigrationNotificationsMain.java
src/main/java/org/onap/aai/util/SendMigrationNotificationsMain.java
src/main/resources/application.properties
src/main/resources/etc/appprops/aaiconfig.properties
src/main/resources/etc/auth/aai_keystore [deleted file]
src/main/resources/etc/auth/realm.properties [deleted file]
src/test/java/org/onap/aai/AAIGremlinQueryTest.java
src/test/java/org/onap/aai/GraphAdminTestConfiguration.java
src/test/java/org/onap/aai/MetricsConfigurationTest.java
src/test/java/org/onap/aai/datagrooming/DataGroomingTest.java
src/test/java/org/onap/aai/dbgen/DupeToolTest.java
src/test/java/org/onap/aai/dbgen/schemamod/SchemaMod4HistTest.java
src/test/java/org/onap/aai/dbgen/schemamod/SchemaModTest.java
src/test/java/org/onap/aai/migration/v12/ALTSLicenseEntitlementMigrationTest.java
src/test/java/org/onap/aai/migration/v12/ContainmentDeleteOtherVPropertyMigrationTest.java
src/test/java/org/onap/aai/migration/v12/DeletePInterfaceTest.java
src/test/java/org/onap/aai/migration/v12/MigrateDataFromASDCToConfigurationTest.java
src/test/java/org/onap/aai/migration/v12/MigrateHUBEvcInventoryTest.java
src/test/java/org/onap/aai/migration/v12/MigrateINVPhysicalInventoryTest.java
src/test/java/org/onap/aai/migration/v12/MigrateInvEvcInventoryTest.java
src/test/java/org/onap/aai/migration/v12/MigratePATHEvcInventoryTest.java
src/test/java/org/onap/aai/migration/v12/MigrateSAREvcInventoryTest.java
src/test/java/org/onap/aai/migration/v12/UriMigrationTest.java
src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartOneTest.java
src/test/java/org/onap/aai/migration/v13/MigrateBadWidgetModelsPartTwoTest.java
src/test/java/org/onap/aai/migration/v13/MigrateBooleanDefaultsToFalseTest.java
src/test/java/org/onap/aai/migration/v13/MigrateForwarderEvcCircuitIdTest.java
src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java
src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupModelVersionIdTest.java
src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupSubTypeTest.java
src/test/java/org/onap/aai/migration/v13/MigrateInstanceGroupTypeTest.java
src/test/java/org/onap/aai/migration/v13/MigrateModelVerTest.java
src/test/java/org/onap/aai/migration/v13/MigratePServerAndPnfEquipTypeTest.java
src/test/java/org/onap/aai/migration/v14/MigrateGenericVnfMgmtOptionsTest.java
src/test/java/org/onap/aai/migration/v14/MigrateSameSourcedRCTROPServerDataTest.java
src/test/java/org/onap/aai/migration/v14/MigrateSdnaIvlanDataTest.java
src/test/java/org/onap/aai/migration/v14/PserverDedupWithDifferentSourcesOfTruthTest.java
src/test/java/org/onap/aai/migration/v15/MigrateBooleanDefaultsToFalseTest.java
src/test/java/org/onap/aai/migration/v15/MigrateCloudRegionUpgradeCycleTest.java
src/test/java/org/onap/aai/migration/v15/MigrateRadcomChangesTest.java
src/test/java/org/onap/aai/rest/SchemaJobStatusControllerTest.java
src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
src/test/resources/application-test.properties
version.properties

diff --git a/pom.xml b/pom.xml
index 6439a55..648447a 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
     <parent>
         <groupId>org.onap.aai.aai-common</groupId>
         <artifactId>aai-parent</artifactId>
-        <version>1.15.4</version>
+        <version>1.15.5</version>
     </parent>
     <groupId>org.onap.aai.graphadmin</groupId>
     <artifactId>aai-graphadmin</artifactId>
-    <version>1.15.4-SNAPSHOT</version>
+    <version>1.15.5-SNAPSHOT</version>
 
     <properties>
 
@@ -55,7 +55,7 @@
         <docker.push.registry>localhost:5000</docker.push.registry>
         <aai.docker.version>1.0.0</aai.docker.version>
         <aai.schema.service.version>1.12.7</aai.schema.service.version>
-        <aai.common.version>1.15.4</aai.common.version>
+        <aai.common.version>1.15.5</aai.common.version>
         <aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/
         </aai.build.directory>
         <aai.docker.namespace>onap</aai.docker.namespace>
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-security</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-test</artifactId>
index 74328ac..0a5d33d 100644 (file)
@@ -22,7 +22,6 @@ package org.onap.aai;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.onap.aai.aailog.logs.AaiDebugLog;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.logging.ErrorLogHelper;
@@ -116,7 +115,6 @@ public class GraphAdminApp {
         try {
             SpringApplication app = new SpringApplication(GraphAdminApp.class);
             app.setRegisterShutdownHook(true);
-            app.addInitializers(new PropertyPasswordConfiguration());
             env = app.run(args).getEnvironment();
         }
 
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright Â© 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright Â© 2025 Deutsche Telekom. 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.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.config;
 
-import org.eclipse.jetty.util.security.Password;
+import java.util.List;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import lombok.Data;
+
+@Data
+@Configuration
+@ConfigurationProperties(prefix = "aai.basic-auth")
+public class AuthProperties {
+
+  boolean enabled = true;
 
-public class JettyPasswordDecoder implements PasswordDecoder {
+  List<User> users;
 
-    @Override
-    public String decode(String input) {
-        if (input.startsWith("OBF:")) {
-            return Password.deobfuscate(input);
-        }
-        return Password.deobfuscate("OBF:" + input);
-    }
+  @Data
+  public static class User {
+    private String username;
+    private String password;
+  }
 }
diff --git a/src/main/java/org/onap/aai/config/PasswordDecoder.java b/src/main/java/org/onap/aai/config/PasswordDecoder.java
deleted file mode 100644 (file)
index 0dcb845..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright Â© 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.aai.config;
-
-public interface PasswordDecoder {
-
-    String decode(String input);
-}
diff --git a/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java b/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java
deleted file mode 100644 (file)
index 306ffa0..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright Â© 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Modification Copyright Â© 2019 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.aai.config;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.commons.io.IOUtils;
-import org.springframework.context.ApplicationContextInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.env.*;
-
-public class PropertyPasswordConfiguration implements ApplicationContextInitializer<ConfigurableApplicationContext> {
-
-    private static final Pattern decodePasswordPattern = Pattern.compile("password\\((.*?)\\)");
-    private PasswordDecoder passwordDecoder = new JettyPasswordDecoder();
-    private static final Logger logger = LoggerFactory.getLogger(PropertyPasswordConfiguration.class.getName());
-
-    @Override
-    public void initialize(ConfigurableApplicationContext applicationContext) {
-        ConfigurableEnvironment environment = applicationContext.getEnvironment();
-        String certPath = environment.getProperty("server.certs.location");
-        File passwordFile = null;
-        File passphrasesFile = null;
-        Map<String, Object> sslProps = new LinkedHashMap<>();
-
-        // Override the passwords from application.properties if we find AAF certman files
-        if (certPath != null) {
-            passwordFile = new File(certPath + ".password");
-            try (InputStream passwordStream = new FileInputStream(passwordFile)) {
-
-                String keystorePassword = null;
-
-                keystorePassword = IOUtils.toString(passwordStream);
-                if (keystorePassword != null) {
-                    keystorePassword = keystorePassword.trim();
-                }
-                sslProps.put("server.ssl.key-store-password", keystorePassword);
-                sslProps.put("schema.service.ssl.key-store-password", keystorePassword);
-            } catch (IOException e) {
-                logger.warn("Not using AAF Certman password file, e=" + e.getMessage());
-            }
-            passphrasesFile = new File(certPath + ".passphrases");
-            try (InputStream passphrasesStream = new FileInputStream(passphrasesFile)) {
-
-                String truststorePassword = null;
-                Properties passphrasesProps = new Properties();
-                passphrasesProps.load(passphrasesStream);
-                truststorePassword = passphrasesProps.getProperty("cadi_truststore_password");
-                if (truststorePassword != null) {
-                    truststorePassword = truststorePassword.trim();
-                }
-                sslProps.put("server.ssl.trust-store-password", truststorePassword);
-                sslProps.put("schema.service.ssl.trust-store-password", truststorePassword);
-            } catch (IOException e) {
-                logger.warn("Not using AAF Certman passphrases file, e=" + e.getMessage());
-            }
-        }
-        for (PropertySource<?> propertySource : environment.getPropertySources()) {
-            Map<String, Object> propertyOverrides = new LinkedHashMap<>();
-            decodePasswords(propertySource, propertyOverrides);
-            if (!propertyOverrides.isEmpty()) {
-                PropertySource<?> decodedProperties = new MapPropertySource("decoded "+ propertySource.getName(), propertyOverrides);
-                environment.getPropertySources().addBefore(propertySource.getName(), decodedProperties);
-            }
-
-        }
-        if (!sslProps.isEmpty()) {
-            logger.info("Using AAF Certman files");
-            PropertySource<?> additionalProperties = new MapPropertySource("additionalProperties", sslProps);
-            environment.getPropertySources().addFirst(additionalProperties);
-        }
-    }
-
-    private void decodePasswords(PropertySource<?> source, Map<String, Object> propertyOverrides) {
-        if (source instanceof EnumerablePropertySource) {
-            EnumerablePropertySource<?> enumerablePropertySource = (EnumerablePropertySource<?>) source;
-            for (String key : enumerablePropertySource.getPropertyNames()) {
-                Object rawValue = source.getProperty(key);
-                if (rawValue instanceof String) {
-                    String decodedValue = decodePasswordsInString((String) rawValue);
-                    propertyOverrides.put(key, decodedValue);
-                }
-            }
-        }
-    }
-
-    private String decodePasswordsInString(String input) {
-        if (input == null) {
-            return null;
-        }
-        StringBuffer output = new StringBuffer();
-        Matcher matcher = decodePasswordPattern.matcher(input);
-        while (matcher.find()) {
-            String replacement = passwordDecoder.decode(matcher.group(1));
-            matcher.appendReplacement(output, replacement);
-        }
-        matcher.appendTail(output);
-        return output.toString();
-    }
-
-}
diff --git a/src/main/java/org/onap/aai/config/SecurityConfig.java b/src/main/java/org/onap/aai/config/SecurityConfig.java
new file mode 100644 (file)
index 0000000..a2872ba
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright Â© 2025 Deutsche Telekom. 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.aai.config;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
+import org.springframework.util.AntPathMatcher;
+
+@Configuration
+@ConditionalOnProperty(name = "aai.basic-auth.enabled", havingValue = "true", matchIfMissing = true)
+public class SecurityConfig {
+
+    @Bean
+    SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception{
+        httpSecurity.csrf(csrf -> csrf.disable())
+            .authorizeHttpRequests(requests -> requests
+                .antMatchers("/util/echo", "/actuator/**")
+                .permitAll()
+                .anyRequest()
+                .authenticated())
+            .httpBasic();
+
+        return httpSecurity.build();
+    }
+
+    @Bean
+    InMemoryUserDetailsManager userDetailsService(AuthProperties userProperties) {
+        UserDetails[] users = userProperties.getUsers().stream()
+            .map(user -> User.withDefaultPasswordEncoder()
+                .username(user.getUsername())
+                .password(user.getPassword())
+                .roles("someRole")
+                .build())
+            .toArray(UserDetails[]::new);
+
+        return new InMemoryUserDetailsManager(users);
+    }
+}
index a7cf4c4..d7c36ad 100644 (file)
@@ -58,7 +58,6 @@ import org.onap.aai.introspection.ModelType;
 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.onap.aai.logging.ErrorLogHelper;
 import org.onap.aai.logging.LogFormatTools;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.setup.SchemaVersions;
 import org.onap.aai.util.AAIConfig;
 import org.onap.aai.util.AAIConstants;
@@ -277,7 +276,7 @@ public class DataGrooming {
             LOGGER.info("One-Armed Edge Hash Count: " + getOneArmedEdgeHashCount());
                        // Add more logging if needed for other nodes like Duplicate Groups, Delete Candidates, etc.
             LOGGER.info("===== End of Data Grooming Summary =====");
+
                } catch (Exception ex) {
                        LOGGER.debug("Exception while grooming data " + LogFormatTools.getStackTop(ex));
                }
@@ -296,8 +295,6 @@ public class DataGrooming {
                System.setProperty("aai.service.name", DataGrooming.class.getSimpleName());
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
 
                try {
                        ctx.scan(
index 071e490..fdf81aa 100644 (file)
@@ -39,7 +39,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.commons.configuration2.PropertiesConfiguration;
 import org.apache.tinkerpop.gremlin.structure.io.IoCore;
@@ -112,8 +111,6 @@ public class DataSnapshot4HistInit {
                System.setProperty("aai.service.name", DataSnapshot4HistInit.class.getSimpleName());
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index 36aa560..5a09aee 100644 (file)
@@ -23,7 +23,8 @@ import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Date;
 
 import org.onap.aai.aailog.logs.AaiScheduledTaskAuditLog;
 import org.onap.aai.exceptions.AAIException;
index 08ab86d..d71138a 100644 (file)
@@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.commons.configuration2.PropertiesConfiguration;
 import org.janusgraph.core.JanusGraph;
 import org.janusgraph.core.JanusGraphFactory;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.dbmap.AAIGraphConfig;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.exceptions.AAIException;
@@ -59,8 +58,6 @@ public class ScriptDriver {
                }
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index 8dbe1c6..d65ae25 100644 (file)
@@ -27,7 +27,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.*;
 import org.janusgraph.core.JanusGraph;
 import org.janusgraph.core.JanusGraphFactory;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.dbmap.AAIGraphConfig;
 import org.onap.aai.edges.enums.AAIDirection;
@@ -465,8 +464,6 @@ public class DupeTool {
 
 
         AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-        PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-        initializer.initialize(ctx);
         try {
             ctx.scan(
                     "org.onap.aai.config",
index 63bdea1..f9c9e4b 100644 (file)
@@ -31,7 +31,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.dbmap.InMemoryGraph;
 import org.onap.aai.edges.EdgeIngestor;
@@ -148,8 +147,6 @@ public class DynamicPayloadGenerator {
        }
        public static void main(String[] args) throws AAIException {
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index f0be6d4..1e96223 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.onap.aai.dbgen.schemamod;
 
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.LoaderFactory;
@@ -173,8 +172,6 @@ public class SchemaMod {
                MDC.put("logFilenameAppender", SchemaMod.class.getSimpleName());
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index ceb2191..e806883 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.onap.aai.dbgen.schemamod;
 
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.LoaderFactory;
@@ -38,7 +37,6 @@ import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
-
 public class SchemaMod4Hist {
 
        private final LoaderFactory loaderFactory;
@@ -157,8 +155,6 @@ public class SchemaMod4Hist {
        public static void main(String[] args) throws AAIException {
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index 7204e57..cfa7682 100644 (file)
@@ -25,6 +25,7 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
+
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.schema.ConsistencyModifier;
@@ -49,8 +50,8 @@ public class SchemaModInternalBatch {
        private final Cardinality cardinality;
        private final long commitBlockSize;
        private final Logger logger;
-       
-       public SchemaModInternalBatch(TransactionalGraphEngine engine, Logger logger, String propName,  
+
+       public SchemaModInternalBatch(TransactionalGraphEngine engine, Logger logger, String propName,
                                String type, String indexType, boolean preserveData, boolean consistencyLock, long commitBlockSize) {
                this.engine = engine;
                this.propName = propName;
@@ -62,8 +63,8 @@ public class SchemaModInternalBatch {
                this.commitBlockSize = commitBlockSize;
                this.logger = logger;
        }
-       
-       
+
+
        private Class<?> determineClass(String type) {
                final Class<?> result;
                if (type.equals("String")) {
@@ -87,10 +88,10 @@ public class SchemaModInternalBatch {
                        logAndPrint(logger, emsg);
                        throw new RuntimeException(emsg);
                }
-               
+
                return result;
        }
-       
+
        private Cardinality determineCardinality(String type) {
                if (type.equals("Set<String>")) {
                        return Cardinality.SET;
@@ -98,7 +99,7 @@ public class SchemaModInternalBatch {
                        return Cardinality.SINGLE;
                }
        }
-       
+
        public void execute() {
                JanusGraphManagement graphMgt = null;
                String retiredName = "";
@@ -106,10 +107,10 @@ public class SchemaModInternalBatch {
                long timeStart = System.nanoTime();
                int batchCt = 0;
                int totalCount = 0;
-               
+
                ArrayList<HashMap<String,Object>> allVerts = new ArrayList<HashMap<String,Object>>();
                HashMap<String,Object> batchVHash = new HashMap<String,Object>();
-               
+
                try {
                        // Make sure this property is in the DB.
                        graphMgt = engine.asAdmin().getManagementSystem();
@@ -124,9 +125,9 @@ public class SchemaModInternalBatch {
                                logAndPrint(logger, emsg);
                                System.exit(1);
                        }
-                       
-                       // Collect the data that needs to be processed and 
-                       // store as hashes of vertex-id's and the original property value 
+
+                       // Collect the data that needs to be processed and
+                       // store as hashes of vertex-id's and the original property value
                        long timeA = System.nanoTime();
                        int msgEveryXCount = 1000;
                        Graph grTmp1 = engine.startTransaction();
@@ -154,37 +155,37 @@ public class SchemaModInternalBatch {
                                        logAndPrint(logger, "Collecting the data for batch # " + batchKey );
                                        batchVCount = 0;
                                        batchVHash = new HashMap<String,Object>();
-                               }       
+                               }
                                if( msgCount > msgEveryXCount ) {
                                        msgCount = 0;
-                                       logAndPrint(logger, " Initial processing running...  total so far = " + totalCount );                                   
+                                       logAndPrint(logger, " Initial processing running...  total so far = " + totalCount );
                                }
                        }
-                       
+
                        if( batchVCount > 0 ) {
                                // Add the last partial set if there is one.
                                allVerts.add(batchKey, batchVHash);
                        }
                        logAndPrint(logger, "Found " + totalCount + " nodes that will be affected. ");
-                       
+
                        batchCt = batchKey +1;
-                       
+
                        if( totalCount == 0 ) {
                                logAndPrint(logger, "INFO -- No data found to process.  ");
                                System.exit(1);
                        }
-                       
+
                        logAndPrint(logger, "INFO -- Total of " + totalCount +
-                                       " nodes to process.  Will use " + batchCt + 
+                                       " nodes to process.  Will use " + batchCt +
                                        " batches. " );
-                       
+
                        long timeB = System.nanoTime();
                        long diffTime =  timeB - timeA;
                        long minCount = TimeUnit.NANOSECONDS.toMinutes(diffTime);
                        long secCount = TimeUnit.NANOSECONDS.toSeconds(diffTime) - (60 * minCount);
                        logAndPrint(logger, "    -- To collect all nodes took: " +
                                        minCount + " minutes, " + secCount + " seconds " );
-                       
+
                        if (indexType.equals("uniqueIndex")) {
                                // Make sure the data in the property being changed can have a
                                // unique-index put on it.
@@ -209,18 +210,18 @@ public class SchemaModInternalBatch {
                                logAndPrint(logger, "-- Finished/Passed UniquePropertyCheck. ");
                                logAndPrint(logger, "There are " + totalCount + " nodes that have this property. ");
                        }
-                                       
+
                        // ---- If we made it to here - we must be OK with making this change
-                       
+
                        // Rename this property to a backup name (old name with a dateString and
                        //    "-RETIRED" appended)
                        long timeE = System.nanoTime();
                        FormatDate fd = new FormatDate("MMddHHmm", "GMT");
-                       String dteStr= fd.getDateTime();                        
+                       String dteStr= fd.getDateTime();
                        retiredName = propName + "-" + dteStr + "-RETIRED";
-                       graphMgt.changeName(origPropKey, retiredName);                  
-                       logAndPrint(logger, " -- Temporary property name will be: [" + retiredName + "]. "); 
-       
+                       graphMgt.changeName(origPropKey, retiredName);
+                       logAndPrint(logger, " -- Temporary property name will be: [" + retiredName + "]. ");
+
                        // Create a new property using the original property name and the
                        // targetDataType
                        PropertyKey freshPropKey = graphMgt.makePropertyKey(propName).dataType(type)
@@ -243,18 +244,18 @@ public class SchemaModInternalBatch {
                                logAndPrint(logger, " -- Consistency Lock is being set on the index ");
                                graphMgt.setConsistency(indexG, ConsistencyModifier.LOCK);
                        }
-       
+
                        logAndPrint(logger, "Committing schema changes with graphMgt.commit()");
                        graphMgt.commit();
                        success = true;
-                       
+
                        long timeF = System.nanoTime();
                        diffTime =  timeF - timeE;
                        minCount = TimeUnit.NANOSECONDS.toMinutes(diffTime);
                        secCount = TimeUnit.NANOSECONDS.toSeconds(diffTime) - (60 * minCount);
                        logAndPrint(logger, "    -- Temporary property Name Change took: " +
                                        minCount + " minutes, " + secCount + " seconds " );
-                       
+
                } catch (Exception ex) {
                        logAndPrint(logger, "Threw a regular Exception: ");
                        logAndPrint(logger, ex.getMessage());
@@ -273,8 +274,8 @@ public class SchemaModInternalBatch {
                                }
                        }
                }
-                       
-               
+
+
                // For each node that has this property, update the new from the old
                // and then remove the old property from that node
                // Note - do it in batches since there can be a LOT of updates.
@@ -284,27 +285,27 @@ public class SchemaModInternalBatch {
                for( int batNo=0; batNo < batchCt; batNo++ ) {
                        try {
                                logAndPrint(logger, "BEGIN -- Batch # " + batNo );
-                               processUpdateForBatch(  allVerts.get(batNo), retiredName ); 
+                               processUpdateForBatch(  allVerts.get(batNo), retiredName );
                                logAndPrint(logger, "Completed Batch # " + batNo );
                        } catch (Exception e) {
                                String emsg = "ERROR -- Batch # " + batNo +
-                                       " failed to process.  Please clean up manually. " + 
-                                       " data in [" + retiredName + 
-                                       "] will have to be moved to the original property.";            
+                                       " failed to process.  Please clean up manually. " +
+                                       " data in [" + retiredName +
+                                       "] will have to be moved to the original property.";
                                logAndPrint(logger, emsg);
                                emsgList.add(emsg);
                        }
-               }       
+               }
                long timeF = System.nanoTime();
                long diffTime =  timeF - timeE;
                long minCount = TimeUnit.NANOSECONDS.toMinutes(diffTime);
                long secCount = TimeUnit.NANOSECONDS.toSeconds(diffTime) - (60 * minCount);
                logAndPrint(logger, "    -- Time to process all batches: " +
                                minCount + " minutes, " + secCount + " seconds " );
-               
+
                logAndPrint(logger, "\nINFO -- Total of " + totalCount +
                                " nodes processed using: " + batchCt + " batches. " );
-               
+
                if( !emsgList.isEmpty() ) {
                        Iterator <String> eItr = emsgList.iterator();
                        logAndPrint(logger, ">>> These will need to be taken care of: ");
@@ -312,30 +313,30 @@ public class SchemaModInternalBatch {
                                logAndPrint(logger, (String)eItr.next());
                        }
                }
-                                                       
+
                long timeEnd = System.nanoTime();
                diffTime =  timeEnd - timeStart;
                minCount = TimeUnit.NANOSECONDS.toMinutes(diffTime);
                secCount = TimeUnit.NANOSECONDS.toSeconds(diffTime) - (60 * minCount);
                logAndPrint(logger, "    -- Total Processing time was: " +
                                minCount + " minutes, " + secCount + " seconds " );
-               
+
        }// End of Execute()
-       
-       
-       private void processUpdateForBatch( HashMap<String,Object> vertHash, 
+
+
+       private void processUpdateForBatch( HashMap<String,Object> vertHash,
                        String retiredName ) throws Exception {
-                       
+
                Iterator<Map.Entry<String, Object>> vertHashItr = vertHash.entrySet().iterator();
                int vtxCount = 0;
                Boolean success = false;
-               Graph grTmpBat = engine.startTransaction();     
-               try { 
+               Graph grTmpBat = engine.startTransaction();
+               try {
                        while( vertHashItr.hasNext() ){
-                               Map.Entry<String, Object> entry = vertHashItr.next(); 
+                               Map.Entry<String, Object> entry = vertHashItr.next();
                                String tmpVid = entry.getKey();
                                Vertex tmpVtx = null;
-                               
+
                                Iterator<Vertex> oneVItr = grTmpBat.traversal().V(tmpVid);
                                while( oneVItr.hasNext() ) {
                                        // should never find more than one...
@@ -350,7 +351,7 @@ public class SchemaModInternalBatch {
                                        }
                                        tmpVtx.property(retiredName).remove();
                                        logAndPrint(logger, "INFO -- update item: (vid= "
-                                                       + tmpVid + ", val=[" + origVal + "])"); 
+                                                       + tmpVid + ", val=[" + origVal + "])");
                                        vtxCount++;
                                }
                        }
@@ -369,31 +370,31 @@ public class SchemaModInternalBatch {
                                        logAndPrint(logger, "ERROR -- rolling back node updates for this batch.");
                                        engine.rollback();
                                }
-                       }               
+                       }
                }
                if( ! success ) {
                        throw new Exception ("ERROR - could not process this batch -- see the log for details.");
                }
-               
-       }// end of processUpdateForBatch()      
-       
+
+       }// end of processUpdateForBatch()
+
 
        private Boolean doUniquenessCheck( ArrayList<HashMap<String,Object>> allVerts,
                        String propertyName ){
-               // Note - property can be found in more than one nodetype 
-               //   our uniqueness constraints are always across the entire db - so this 
+               // Note - property can be found in more than one nodetype
+               //   our uniqueness constraints are always across the entire db - so this
                //   tool looks across all nodeTypes that the property is found in.
                long timeStart = System.nanoTime();
                int batchCt = allVerts.size();
                HashMap <String,Object> bigSingleHash = new HashMap <String,Object> ();
-               
+
                for( int batNo=0; batNo < batchCt; batNo++ ) {
                        bigSingleHash.putAll(allVerts.get(batNo));
                }
-               
+
                ArrayList <Object> dupeValues = new ArrayList<Object> ();
                int dupeCount = 0;
-                               
+
                Iterator bItr = bigSingleHash.entrySet().iterator();
                while( bItr.hasNext() ) {
                        Map.Entry pair = (Map.Entry)bItr.next();
@@ -414,19 +415,19 @@ public class SchemaModInternalBatch {
                        dupeCount++;
                }
                }
-               
+
                long timeEnd = System.nanoTime();
                long diffTime =  timeEnd - timeStart;
                long minCount = TimeUnit.NANOSECONDS.toMinutes(diffTime);
                long secCount = TimeUnit.NANOSECONDS.toSeconds(diffTime) - (60 * minCount);
                logAndPrint(logger, "    -- Total Uniqueness Check took: " +
                                minCount + " minutes, " + secCount + " seconds " );
-               
+
                if( dupeValues.isEmpty() ){
                        logAndPrint(logger, "\n ------------ No Duplicates Found -------- \n");
                }
                else {
-                       logAndPrint(logger, "\n -------------- Found " + dupeCount + 
+                       logAndPrint(logger, "\n -------------- Found " + dupeCount +
                        " cases of duplicate values for property [" + propertyName + "\n\n");
                        logAndPrint(logger, "\n --- These values are in the db twice or more: ");
                Iterator <?> dupeValItr = dupeValues.iterator();
@@ -434,16 +435,16 @@ public class SchemaModInternalBatch {
                        logAndPrint(logger, " value = [" + dupeValItr.next() + "]");
                }
        }
-       
+
                if( dupeCount > 0 ) {
                        return true;
                }else {
                        return false;
                }
-       
+
        }// end of doUniquenessCheck()
-       
-       
+
+
 
        /**
         * Log and print.
@@ -455,5 +456,5 @@ public class SchemaModInternalBatch {
                System.out.println(msg);
                logger.debug(msg);
        }
-       
+
 }
index f49a02e..eb4db3a 100644 (file)
@@ -19,7 +19,9 @@
  */
 package org.onap.aai.historytruncate;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
index 7e8b0ca..4cb33fc 100644 (file)
@@ -23,7 +23,7 @@ import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
 
 import org.onap.aai.aailog.logs.AaiScheduledTaskAuditLog;
 import org.onap.aai.exceptions.AAIException;
@@ -37,6 +37,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 @Component
 @PropertySource("file:${server.local.startpath}/etc/appprops/datatoolscrons.properties")
 public class HistoryTruncateTasks {
diff --git a/src/main/java/org/onap/aai/interceptors/pre/OneWaySslAuthorization.java b/src/main/java/org/onap/aai/interceptors/pre/OneWaySslAuthorization.java
deleted file mode 100644 (file)
index b9fc978..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright Â© 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.aai.interceptors.pre;
-
-import org.onap.aai.Profiles;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.interceptors.AAIContainerFilter;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.service.AuthorizationService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-
-import javax.annotation.Priority;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.PreMatching;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.Provider;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-@Provider
-@Profile(Profiles.ONE_WAY_SSL)
-@PreMatching
-@Priority(AAIRequestFilterPriority.AUTHORIZATION)
-public class OneWaySslAuthorization extends AAIContainerFilter implements ContainerRequestFilter {
-
-    @Autowired
-    private AuthorizationService authorizationService;
-
-    @Override
-    public void filter(ContainerRequestContext containerRequestContext) throws IOException
-    {
-
-        if(containerRequestContext.getUriInfo().getRequestUri().getPath().matches("^.*/util/echo$")){
-            return;
-        }
-
-        String basicAuth = containerRequestContext.getHeaderString("Authorization");
-        List<MediaType> acceptHeaderValues = containerRequestContext.getAcceptableMediaTypes();
-
-        if(basicAuth == null || !basicAuth.startsWith("Basic ")){
-            Optional<Response> responseOptional = errorResponse("AAI_3300", acceptHeaderValues);
-            containerRequestContext.abortWith(responseOptional.get());
-            return;
-        }
-
-        basicAuth = basicAuth.replaceAll("Basic ", "");
-
-        if(!authorizationService.checkIfUserAuthorized(basicAuth)){
-            Optional<Response> responseOptional = errorResponse("AAI_3300", acceptHeaderValues);
-            containerRequestContext.abortWith(responseOptional.get());
-            return;
-        }
-
-    }
-
-    private Optional<Response> errorResponse(String errorCode, List<MediaType> acceptHeaderValues) {
-        AAIException aaie = new AAIException(errorCode);
-        return Optional.of(Response.status(aaie.getErrorObject().getHTTPResponseCode())
-                .entity(ErrorLogHelper.getRESTAPIErrorResponse(acceptHeaderValues, aaie, new ArrayList<>()))
-                .build());
-
-    }
-}
index 29c4026..6b3b0a6 100644 (file)
@@ -24,7 +24,6 @@ import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.LoaderFactory;
 import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.setup.SchemaVersions;
 import org.onap.aai.util.ExceptionTranslator;
@@ -45,8 +44,6 @@ public class MigrationController {
        public static void main(String[] args) throws AAIException {
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index 1bdddf3..2132b9c 100644 (file)
@@ -44,7 +44,10 @@ import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Migrator;
+import org.onap.aai.migration.Status;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersions;
index 39224ad..6629620 100644 (file)
@@ -24,7 +24,10 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Migrator;
+import org.onap.aai.migration.Status;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersions;
index de97408..a5941ca 100644 (file)
@@ -53,7 +53,10 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Migrator;
+import org.onap.aai.migration.Status;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
index 2894883..af7a845 100644 (file)
@@ -56,7 +56,10 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.introspection.Introspector;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Migrator;
+import org.onap.aai.migration.Status;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
index d102f99..679ce2c 100644 (file)
@@ -25,7 +25,10 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Migrator;
+import org.onap.aai.migration.Status;
 import org.onap.aai.edges.enums.EdgeType;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
index 9d7715e..7d6d1e9 100644 (file)
@@ -35,13 +35,19 @@ import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.LoaderFactory;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.serialization.db.EdgeSerializer;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Migrator;
+import org.onap.aai.migration.Status;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.setup.SchemaVersions;
 
 import java.time.temporal.ChronoUnit;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Optional;
+import java.util.Set;
 
 /**
  * Remove old aai-uri index per
index 15649e1..2fa085f 100644 (file)
@@ -36,7 +36,10 @@ import org.javatuples.Pair;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.EdgeSwingMigrator;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Status;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersions;
index ffe7266..85325b7 100644 (file)
@@ -22,7 +22,9 @@ package org.onap.aai.migration.v14;
 import java.nio.charset.UnsupportedCharsetException;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.javatuples.Pair;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.edges.EdgeIngestor;
@@ -30,7 +32,10 @@ import org.onap.aai.edges.enums.AAIDirection;
 import org.onap.aai.edges.enums.EdgeProperty;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.EdgeSwingMigrator;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Status;
 import org.onap.aai.introspection.Introspector;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
index 667648b..ad3181b 100644 (file)
@@ -23,7 +23,9 @@ import java.nio.charset.UnsupportedCharsetException;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.javatuples.Pair;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.edges.EdgeIngestor;
@@ -31,7 +33,10 @@ import org.onap.aai.edges.enums.AAIDirection;
 import org.onap.aai.edges.enums.EdgeProperty;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.migration.*;
+import org.onap.aai.migration.EdgeSwingMigrator;
+import org.onap.aai.migration.MigrationDangerRating;
+import org.onap.aai.migration.MigrationPriority;
+import org.onap.aai.migration.Status;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.springframework.web.util.UriUtils;
 
@@ -63,8 +68,8 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
     private static List<Introspector> dmaapDeleteList = new ArrayList<Introspector>();
     private static int pserversUpdatedCount = 0;
     private static int pserversDeletedCount = 0;
-    
-    
+
+
     private static String[] rctSourceOfTruth = new String[]{"AAIRctFeed", "RCT"};
     private static String[] roSourceOfTruth = new String[]{"AAI-EXTENSIONS", "RO"};
 
@@ -128,7 +133,7 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
 
     @Override
     public void run() {
-       
+
        int dupCount = 0;
         nodeTypeToUri = loader.getAllObjects().entrySet().stream().filter(e -> e.getValue().getGenericURI().contains("{")).collect(
                 Collectors.toMap(
@@ -144,10 +149,10 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
 
         List<Vertex> rctList = graphTraversalSource().V().has("aai-node-type", "pserver").has("source-of-truth", P.within(rctSourceOfTruth)).toList();
         List<Vertex> roList =  graphTraversalSource().V().has("aai-node-type", "pserver").has("source-of-truth", P.within(roSourceOfTruth)).toList();
-        
+
         logger.info("Total number of RCT sourced pservers in A&AI :" +rctList.size());
         logger.info("Total number of RO sourced pservers in A&AI :" +roList.size());
-        
+
         for(int i=0;i<rctList.size();i++){
             Vertex currRct = rctList.get(i);
             Object currRctFqdn = null;
@@ -222,7 +227,7 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
                Iterator<Vertex> pIntListItr = pIntList.iterator();
                while(pIntListItr.hasNext()){
                        Vertex pInt = pIntListItr.next();
-                       
+
                        removeROPIntMap.put(pInt.property("interface-name").value().toString(), pInt);
                }
                Set<String> interfaceNameSet = removeROPIntMap.keySet();
@@ -245,9 +250,9 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
                                }
                        }
                }
-       } 
+       }
        }
-    
+
     private void dropMatchingROLagInterfaces(Vertex ro, Vertex rct) {
         Map<String, Vertex> removeROLagIntMap = new HashMap<String, Vertex>();
        List<Vertex> lagIntList = graphTraversalSource().V(ro).in("tosca.relationships.network.BindsTo").has("aai-node-type","lag-interface").toList();
@@ -255,7 +260,7 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
                Iterator<Vertex> lagIntListItr = lagIntList.iterator();
                while(lagIntListItr.hasNext()){
                        Vertex lagInt = lagIntListItr.next();
-                       
+
                        removeROLagIntMap.put(lagInt.property("interface-name").value().toString(), lagInt);
                }
                Set<String> interfaceNameSet = removeROLagIntMap.keySet();
@@ -278,9 +283,9 @@ public class PserverDedupWithDifferentSourcesOfTruth extends EdgeSwingMigrator {
                                }
                        }
                }
-       } 
+       }
        }
-    
+
        public void dropComplexEdge(Vertex ro){
        List<Vertex> locatedInEdgeVertexList = graphTraversalSource().V(ro).has("aai-node-type", "pserver").out("org.onap.relationships.inventory.LocatedIn").has("aai-node-type","complex").toList();
        if (locatedInEdgeVertexList != null && !locatedInEdgeVertexList.isEmpty()){
index bd06f72..226e681 100644 (file)
@@ -34,7 +34,9 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import java.net.ConnectException;
 import java.net.SocketTimeoutException;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
 
 @Service
 public class ApertureService {
index a888536..5b4fa0d 100644 (file)
@@ -50,16 +50,6 @@ public class ApertureServiceOneWayClient extends OneWaySSLRestClient {
         return baseUrl;
     }
 
-    @Override
-    protected String getTruststorePath() {
-        return truststorePath;
-    }
-
-    @Override
-    protected char[] getTruststorePassword() {
-        return truststorePassword.toCharArray();
-    }
-
     @Override
     protected HttpComponentsClientHttpRequestFactory getHttpRequestFactory() throws Exception {
         HttpComponentsClientHttpRequestFactory requestFactory = super.getHttpRequestFactory();
index da32fbe..19c32fb 100644 (file)
@@ -56,26 +56,6 @@ public class ApertureServiceRestClient extends TwoWaySSLRestClient {
         return baseUrl;
     }
 
-    @Override
-    protected String getKeystorePath() {
-        return keystorePath;
-    }
-
-    @Override
-    protected String getTruststorePath() {
-        return truststorePath;
-    }
-
-    @Override
-    protected char[] getKeystorePassword() {
-        return keystorePassword.toCharArray();
-    }
-
-    @Override
-    protected char[] getTruststorePassword() {
-        return truststorePassword.toCharArray();
-    }
-
     protected HttpComponentsClientHttpRequestFactory getHttpRequestFactory() throws Exception {
         HttpComponentsClientHttpRequestFactory requestFactory = super.getHttpRequestFactory();
         requestFactory.setConnectionRequestTimeout(timeout);
index 617001c..3568707 100644 (file)
@@ -34,7 +34,6 @@ import org.onap.aai.dbgen.SchemaGenerator;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.util.AAIConfig;
 import org.onap.aai.util.ExceptionTranslator;
 import org.onap.aai.util.GraphAdminDBUtils;
@@ -47,7 +46,7 @@ public class GenTester {
        private static Logger LOGGER;
        private static boolean historyEnabled;
        private static final String SCHEMA_INITIALIZED  = "schema-initialized";
-       
+
        /**
         * The main method.
         *
@@ -62,8 +61,6 @@ public class GenTester {
                boolean addDefaultCR = true;
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
@@ -222,7 +219,7 @@ public class GenTester {
                }
                try {
                        Vertex newVertex = graph.addVertex(SCHEMA_INITIALIZED , false);
-                       LOGGER.info("Created a new vertex with property '{}' set to '{}'", SCHEMA_INITIALIZED , 
+                       LOGGER.info("Created a new vertex with property '{}' set to '{}'", SCHEMA_INITIALIZED ,
                                newVertex.property(SCHEMA_INITIALIZED ).value());
                } catch (Exception e) {
                        LOGGER.error("Error creating a new vertex: {}", e.getMessage(), e);
@@ -277,4 +274,4 @@ public class GenTester {
                graphMgtForClosing.commit();
        }
 
-}
\ No newline at end of file
+}
index c0a4707..45581d8 100644 (file)
@@ -23,16 +23,16 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.janusgraph.core.JanusGraph;
 import org.janusgraph.core.schema.JanusGraphManagement;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.dbgen.SchemaGenerator4Hist;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.util.*;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.ExceptionTranslator;
+import org.onap.aai.util.GraphAdminDBUtils;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
 
-
 public class GenTester4Hist {
 
        private static Logger LOGGER;
@@ -52,8 +52,6 @@ public class GenTester4Hist {
                boolean addDefaultCR = false;  // For History, we do not add the default CloudRegion
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
diff --git a/src/main/java/org/onap/aai/service/AuthorizationService.java b/src/main/java/org/onap/aai/service/AuthorizationService.java
deleted file mode 100644 (file)
index 9b5a614..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright Â© 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.aai.service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.eclipse.jetty.util.security.Password;
-import org.onap.aai.Profiles;
-import org.onap.aai.util.AAIConstants;
-import org.springframework.context.annotation.Profile;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Base64;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.stream.Stream;
-
-@Profile(Profiles.ONE_WAY_SSL)
-@Service
-public class AuthorizationService {
-
-    private static final Logger logger = LoggerFactory.getLogger(AuthorizationService.class);
-
-    private final Map<String, String> authorizedUsers = new HashMap<>();
-
-    private static final Base64.Encoder ENCODER = Base64.getEncoder();
-
-    @PostConstruct
-    public void init(){
-
-        String basicAuthFile = getBasicAuthFilePath();
-
-        try(Stream<String> stream = Files.lines(Paths.get(basicAuthFile))){
-            stream.filter(line -> !line.startsWith("#")).forEach(str -> {
-                byte [] bytes = null;
-
-                String usernamePassword = null;
-                String accessType = null;
-
-                try {
-                    String [] userAccessType = str.split(",");
-
-                    if(userAccessType == null || userAccessType.length != 2){
-                        throw new RuntimeException("Please check the realm.properties file as it is not conforming to the basic auth");
-                    }
-
-                    usernamePassword = userAccessType[0];
-                    accessType       = userAccessType[1];
-
-                    String[] usernamePasswordArray = usernamePassword.split(":");
-
-                    if(usernamePasswordArray == null || usernamePasswordArray.length != 3){
-                        throw new RuntimeException("This username / pwd is not a valid entry in realm.properties");
-                    }
-
-                    String username = usernamePasswordArray[0];
-                    String password = null;
-
-                    if(str.contains("OBF:")){
-                        password = usernamePasswordArray[1] + ":" + usernamePasswordArray[2];
-                        password = Password.deobfuscate(password);
-                    }
-
-                    bytes = ENCODER.encode((username + ":" + password).getBytes("UTF-8"));
-
-                    authorizedUsers.put(new String(bytes), accessType);
-
-                } catch (UnsupportedEncodingException e)
-                {
-                    logger.error("Unable to support the encoding of the file" + basicAuthFile);
-                }
-
-                authorizedUsers.put(new String(ENCODER.encode(bytes)), accessType);
-            });
-        } catch (IOException e) {
-            logger.error("IO Exception occurred during the reading of realm.properties", e);
-        }
-    }
-
-    public boolean checkIfUserAuthorized(String authorization){
-        return authorizedUsers.containsKey(authorization) && "admin".equals(authorizedUsers.get(authorization));
-    }
-
-    public String getBasicAuthFilePath(){
-        return AAIConstants.AAI_HOME_ETC_AUTH + AAIConstants.AAI_FILESEP + "realm.properties";
-    }
-}
index c302e18..c3a40d2 100644 (file)
@@ -21,7 +21,6 @@ package org.onap.aai.util;
 
 import com.beust.jcommander.JCommander;
 import com.beust.jcommander.Parameter;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.LoaderFactory;
@@ -30,7 +29,10 @@ import org.onap.aai.migration.EventAction;
 import org.onap.aai.setup.SchemaVersions;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
 
 public class SendDeleteMigrationNotificationsMain {
 
@@ -41,8 +43,6 @@ public class SendDeleteMigrationNotificationsMain {
                String requestId = UUID.randomUUID().toString();
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index c650134..fbd1010 100644 (file)
@@ -21,7 +21,6 @@ package org.onap.aai.util;
 
 import com.beust.jcommander.JCommander;
 import com.beust.jcommander.Parameter;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.LoaderFactory;
@@ -41,8 +40,6 @@ public class SendMigrationNotificationsMain {
                String requestId = UUID.randomUUID().toString();
 
                AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
-               PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration();
-               initializer.initialize(ctx);
                try {
                        ctx.scan(
                                        "org.onap.aai.config",
index 41d0d74..66f0da5 100644 (file)
@@ -21,16 +21,8 @@ server.tomcat.max-idle-time=60000
 # If you get an application startup failure that the port is already taken
 # If thats not it, please check if the key-store file path makes sense
 server.local.startpath=src/main/resources
-server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties
 
 server.port=8449
-server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
-server.ssl.key-store=${server.local.startpath}/etc/auth/aai_keystore
-server.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
-server.ssl.trust-store=${server.local.startpath}/etc/auth/aai_keystore
-server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
-server.ssl.client-auth=want
-server.ssl.key-store-type=JKS
 
 # dmaap is deprecated and now replaced with kafka
 spring.kafka.producer.bootstrap-servers=${BOOTSTRAP_SERVERS}
@@ -75,21 +67,10 @@ schema.service.nodes.endpoint=nodes?version=
 schema.service.edges.endpoint=edgerules?version=
 schema.service.versions.endpoint=versions
 
-schema.service.ssl.key-store=${server.local.startpath}/etc/auth/aai_keystore
-schema.service.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
-schema.service.ssl.trust-store=${server.local.startpath}/etc/auth/aai_keystore
-schema.service.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
-
-aaf.cadi.file=${server.local.startpath}/cadi.properties
-
 aperture.rdbmsname=aai_relational
 
 aperture.service.client=no-auth
 aperture.service.base.url=http://localhost:8457/aai/aperture
-aperture.service.ssl.key-store=${server.local.startpath}/etc/auth/aai_keystore
-aperture.service.ssl.trust-store=${server.local.startpath}/etc/auth/aai_keystore
-aperture.service.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
-aperture.service.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
 aperture.service.timeout-in-milliseconds=300000
 
 #To Expose the Prometheus scraping endpoint
@@ -112,3 +93,7 @@ aai.notifications.enabled=false
 BOOTSTRAP_SERVERS=localhost:9092
 JAAS_CONFIG=
 aai.graph.properties.path=${server.local.startpath}/etc/appprops/janusgraph-realtime.properties
+
+aai.basic-auth.enabled=true
+aai.basic-auth.users[0].username=AAI
+aai.basic-auth.users[0].password=AAI
index 235cbda..c37394c 100644 (file)
@@ -39,11 +39,6 @@ aai.global.callback.url=https://localhost:8443/aai/
 
 # Start of INTERNAL Specific Properties
 
-aai.truststore.filename=aai_keystore
-aai.truststore.passwd.x=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0
-aai.keystore.filename=aai-client-cert.p12
-aai.keystore.passwd.x=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0
-
 aai.realtime.clients=RO,SDNC,MSO,SO
 
 # End of INTERNAL Specific Properties
diff --git a/src/main/resources/etc/auth/aai_keystore b/src/main/resources/etc/auth/aai_keystore
deleted file mode 100644 (file)
index 16d93a7..0000000
Binary files a/src/main/resources/etc/auth/aai_keystore and /dev/null differ
diff --git a/src/main/resources/etc/auth/realm.properties b/src/main/resources/etc/auth/realm.properties
deleted file mode 100644 (file)
index f0e0172..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# format : username: password[,rolename ...]
-# default username/password: AAI/AAI, MSO/MSO, ModelLoader/ModelLoader...
-AAI:OBF:1gfr1ev31gg7,admin
-MSO:OBF:1jzx1lz31k01,admin
-SDNC:OBF:1itr1i0l1i151isv,admin
-DCAE:OBF:1g8u1f9d1f991g8w,admin
-POLICY:OBF:1mk61i171ima1im41i0j1mko,admin
-ASDC:OBF:1f991j0u1j001f9d,admin
-VID:OBF:1jm91i0v1jl9,admin
-APPC:OBF:1f991ksf1ksf1f9d,admin
-ModelLoader:OBF:1qvu1v2h1sov1sar1wfw1j7j1wg21saj1sov1v1x1qxw,admin
-AaiUI:OBF:1gfr1p571unz1p4j1gg7,admin
-OOF:OBF:1img1ke71ily,admin
index 2c99751..307dfaa 100644 (file)
@@ -27,7 +27,6 @@ import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.util.AAIConfig;
@@ -39,7 +38,6 @@ import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoCo
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Import;
 import org.springframework.http.*;
-import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.web.client.RestTemplate;
 
@@ -66,7 +64,6 @@ import static org.junit.jupiter.api.Assertions.fail;
  */
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = GraphAdminApp.class)
 @EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
-@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
 @Import(GraphAdminTestConfiguration.class)
 @TestPropertySource(
     properties = {
index c53a0d4..bdd2c36 100644 (file)
@@ -24,7 +24,6 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.http.client.HttpClient;
 import org.apache.http.impl.client.HttpClients;
-import org.apache.http.ssl.SSLContextBuilder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.TestConfiguration;
 import org.springframework.boot.web.client.RestTemplateBuilder;
@@ -33,25 +32,17 @@ import org.springframework.core.env.Environment;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.client.ClientHttpResponse;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.util.ResourceUtils;
 import org.springframework.web.client.ResponseErrorHandler;
 import org.springframework.web.client.RestTemplate;
 
 import javax.net.ssl.SSLContext;
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.security.KeyStore;
 
 @TestConfiguration
 public class GraphAdminTestConfiguration {
 
     private static final Logger logger = LoggerFactory.getLogger(GraphAdminTestConfiguration.class);
 
-    @Autowired
-    private Environment env;
-
     /**
      * Create a RestTemplate bean, using the RestTemplateBuilder provided
      * by the auto-configuration.
@@ -59,21 +50,7 @@ public class GraphAdminTestConfiguration {
     @Bean
     RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception {
 
-        char[] trustStorePassword = env.getProperty("server.ssl.trust-store-password").toCharArray();
-        char[] keyStorePassword   = env.getProperty("server.ssl.key-store-password").toCharArray();
-
-        String keyStore = env.getProperty("server.ssl.key-store");
-        String trustStore = env.getProperty("server.ssl.trust-store");
-
-        SSLContextBuilder sslContextBuilder = SSLContextBuilder.create();
-
-        if(env.acceptsProfiles("two-way-ssl")){
-            sslContextBuilder = sslContextBuilder.loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword);
-        }
-
-        SSLContext sslContext = sslContextBuilder
-                .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword)
-                .build();
+        SSLContext sslContext = SSLContext.getDefault();
 
         HttpClient client = HttpClients.custom()
                 .setSSLContext(sslContext)
@@ -112,13 +89,4 @@ public class GraphAdminTestConfiguration {
 
         return restTemplate;
     }
-
-    private KeyStore loadPfx(String file, char[] password) throws Exception {
-        KeyStore keyStore = KeyStore.getInstance("PKCS12");
-        File key = ResourceUtils.getFile(file);
-        try (InputStream in = new FileInputStream(key)) {
-            keyStore.load(in, password);
-        }
-        return keyStore;
-    }
 }
index 481ff0a..d0b833b 100644 (file)
@@ -33,7 +33,6 @@ import org.junit.jupiter.api.Test;
 
 import org.onap.aai.config.SpringContextAware;
 import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.actuate.autoconfigure.web.server.LocalManagementPort;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -54,7 +53,7 @@ import org.springframework.web.client.RestTemplate;
 @AutoConfigureMetrics
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
     classes = {SpringContextAware.class, GraphAdminApp.class})
-@ContextConfiguration(initializers = PropertyPasswordConfiguration.class, classes = {SpringContextAware.class})
+@ContextConfiguration(classes = {SpringContextAware.class})
 @EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
 @Import(GraphAdminTestConfiguration.class)
 @TestPropertySource(locations = "classpath:application-test.properties")
index c709fa0..8de2398 100644 (file)
@@ -41,7 +41,7 @@ import java.util.HashSet;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.fail;
 
 @TestMethodOrder(MethodName.class)
 public class DataGroomingTest extends AAISetup {
index 5ba0f9e..fdf2fec 100644 (file)
@@ -34,7 +34,7 @@ import org.onap.aai.dbmap.AAIGraph;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class DupeToolTest extends AAISetup {
 
index 8c3d669..3f2a525 100644 (file)
@@ -32,7 +32,8 @@ import org.onap.aai.AAISetup;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 @TestMethodOrder(MethodName.class)
 public class SchemaMod4HistTest extends AAISetup {
index 0b71fc0..4056954 100644 (file)
@@ -32,7 +32,7 @@ import org.junit.jupiter.api.TestMethodOrder;
 import org.onap.aai.AAISetup;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.exceptions.AAIException;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.fail;
 
 @TestMethodOrder(MethodName.class)
 public class SchemaModTest extends AAISetup {
index d284981..c40b1f9 100644 (file)
@@ -19,7 +19,7 @@
  */
 package org.onap.aai.migration.v12;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
index 9f39e86..eae4964 100644 (file)
@@ -71,11 +71,11 @@ public class ContainmentDeleteOtherVPropertyMigrationTest extends AAISetup {
                Vertex v2 = g.addV().property("aai-node-type", "l-interface")
                                                        .property("interface-name", "delcontains-test-lint")
                                                        .next();
-               Edge e = v.addEdge("hasLInterface", v2, EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString(), 
+               Edge e = v.addEdge("hasLInterface", v2, EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString(),
                                                                                                        EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.NONE.toString());
-               
+
                Vertex v3 = g.addV().property("aai-node-type", "allotted-resource").next();
-               
+
                Edge e2 = v2.addEdge("uses", v3, EdgeProperty.CONTAINS.toString(), AAIDirection.NONE.toString(),
                                                                                        EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.NONE.toString());
                TransactionalGraphEngine spy = spy(dbEngine);
@@ -87,20 +87,20 @@ public class ContainmentDeleteOtherVPropertyMigrationTest extends AAISetup {
                migration = new ContainmentDeleteOtherVPropertyMigration(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions, "/edgeMigrationTestRules.json");
                migration.run();
        }
-       
+
        @AfterEach
        public void cleanUp() {
                tx.tx().rollback();
                graph.close();
        }
-       
+
        @Test
        public void run() {
-               assertEquals(true, 
-                               g.E().hasLabel("hasLInterface").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.OUT.toString()).hasNext(), 
+               assertEquals(true,
+                               g.E().hasLabel("hasLInterface").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.OUT.toString()).hasNext(),
                                "del other now OUT");
-               assertEquals(true, 
-                               g.E().hasLabel("hasLInterface").has(EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString()).hasNext(), 
+               assertEquals(true,
+                               g.E().hasLabel("hasLInterface").has(EdgeProperty.CONTAINS.toString(), AAIDirection.OUT.toString()).hasNext(),
                                "contains val still same");
                assertEquals(true,
                                g.E().hasLabel("uses").has(EdgeProperty.DELETE_OTHER_V.toString(), AAIDirection.NONE.toString()).hasNext(),
index cd38450..6fa8a0b 100644 (file)
@@ -73,7 +73,7 @@ public class DeletePInterfaceTest extends AAISetup {
                                .property("source-of-truth", "AAI-CSVP-INSTARAMS")
                                .next();
                edgeSerializer.addTreeEdge(g, pnf1, pInterface1);
-               
+
                Vertex pnf2 = g.addV().property("aai-node-type", "pnf")
                                .property("pnf-name", "pnf-name2")
                                .next();
@@ -86,7 +86,7 @@ public class DeletePInterfaceTest extends AAISetup {
                                .next();
                edgeSerializer.addTreeEdge(g, pnf2, pInterface2);
                edgeSerializer.addEdge(g, pInterface2, pLink);
-               
+
                Vertex pnf3 = g.addV().property("aai-node-type", "pnf")
                                .property("pnf-name", "pnf-name3")
                                .next();
@@ -99,7 +99,7 @@ public class DeletePInterfaceTest extends AAISetup {
                                .next();
                edgeSerializer.addTreeEdge(g, pnf3, pInterface3);
                edgeSerializer.addTreeEdge(g, pInterface3, lInterface);
-               
+
                Vertex pnf4 = g.addV().property("aai-node-type", "pnf")
                                .property("pnf-name", "pnf-name4")
                                .next();
@@ -107,7 +107,7 @@ public class DeletePInterfaceTest extends AAISetup {
                                .property("interface-name", "interface-name4")
                                .next();
                edgeSerializer.addTreeEdge(g, pnf4, pInterface4);
-               
+
                TransactionalGraphEngine spy = spy(dbEngine);
                TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
                GraphTraversalSource traversal = g;
@@ -127,16 +127,16 @@ public class DeletePInterfaceTest extends AAISetup {
        public void test() {
                assertEquals(false, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name1")
                                .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").has("interface-name", "interface-name1").hasNext(), "pInterface1 deleted");
-               
+
                assertEquals(true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name2")
                                .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").hasNext(), "pInterface2 skipped");
-               
+
                assertEquals(true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name3")
                                .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").hasNext(), "pInterface3 skipped");
-               
+
                assertEquals(true, g.V().has("aai-node-type", "pnf").has("pnf-name", "pnf-name4")
                                .in("tosca.relationships.network.BindsTo").has("aai-node-type", "p-interface").has("interface-name", "interface-name4").hasNext(), "pInterface4 should not be deleted");
-               
+
                assertEquals(Status.SUCCESS, migration.getStatus(), "Status should be success");
        }
 
index 328ede6..c22c5f9 100644 (file)
@@ -71,7 +71,7 @@ public class MigrateDataFromASDCToConfigurationTest extends AAISetup {
         dbEngine = new JanusGraphDBEngine(
                 queryStyle,
                 loader);
-        
+
         System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
         Vertex genericvnf1 = g.addV().property("aai-node-type", "generic-vnf")
                 .property("vnf-id", "vnfId1")
index 0dfd821..31f7e36 100644 (file)
@@ -66,18 +66,18 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                                loader);
 
                System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
-               
+
                Vertex customer1 = g.addV()
                                .property("aai-node-type", "customer")
                                .property("global-customer-id", "customer-id-1")
                                .property("subscriber-type", "CUST")
                                .next();
-               
+
                Vertex servSub1 = g.addV()
                                .property("aai-node-type", "service-subscription")
                                .property("service-type", "SAREA")
                                .next();
-               
+
                Vertex servInstance1 = g.addV()
                                .property("aai-node-type", "service-instance")
                                .property("service-type", "SAREA")
@@ -93,7 +93,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                                .property("service-type", "SAREA")
                                .property("service-instance-id", "evc-name-2")
                                .next();
-               
+
                Vertex evc1 = g.addV().property("aai-node-type", "evc")
                                .property("evc-id", "evc-name-1")
                                .next();
@@ -132,9 +132,9 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                                .property("forwarder-evc-id", "evc-name-1-2")
                                .property("svlan",  "16")
                                .next();
-               
-               
-               
+
+
+
                Vertex evc2 = g.addV().property("aai-node-type", "evc")
                                .property("evc-id", "evc-name-2")
                                .next();
@@ -242,24 +242,24 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                                .property("forwarder-evc-id", "evc-name-3-2")
 //                             .property("svlan",  "16")
                                .next();
-               
+
                // graph 1
                edgeSerializer.addTreeEdge(g, customer1, servSub1);
                edgeSerializer.addTreeEdge(g, servSub1, servInstance1);
                edgeSerializer.addTreeEdge(g, servSub1, servInstance2);
                edgeSerializer.addTreeEdge(g, servSub1, servInstance3);
-               
+
                edgeSerializer.addEdge(g, servInstance1, fp1);
                edgeSerializer.addEdge(g, servInstance2, fp2);
-               
+
                edgeSerializer.addEdge(g, fp1, config1);
                edgeSerializer.addEdge(g, fp2, config2);
                edgeSerializer.addEdge(g, fp3, config3);
-               
+
                edgeSerializer.addTreeEdge(g, evc1,  config1);
                edgeSerializer.addTreeEdge(g, evc2, config2);
                edgeSerializer.addTreeEdge(g, evc3, config3);
-               
+
                edgeSerializer.addTreeEdge(g, fp1, for11);
                edgeSerializer.addTreeEdge(g, fp1, for12);
                edgeSerializer.addTreeEdge(g, fp2, for21);
@@ -268,7 +268,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                edgeSerializer.addTreeEdge(g, fp2, for24);
                edgeSerializer.addTreeEdge(g, fp3, for31);
                edgeSerializer.addTreeEdge(g, fp3, for32);
-               
+
                edgeSerializer.addEdge(g,  for11, config11);
                edgeSerializer.addEdge(g,  for12, config12);
                edgeSerializer.addEdge(g,  for21, config21);
@@ -277,7 +277,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                edgeSerializer.addEdge(g,  for24, config24);
                edgeSerializer.addEdge(g,  for31, config31);
                edgeSerializer.addEdge(g,  for32, config32);
-               
+
                edgeSerializer.addTreeEdge(g, config11, fevc11);
                edgeSerializer.addTreeEdge(g, config12, fevc12);
                edgeSerializer.addTreeEdge(g, config21, fevc21);
@@ -286,7 +286,7 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                edgeSerializer.addTreeEdge(g, config24, fevc24);
                edgeSerializer.addTreeEdge(g, config31, fevc31);
                edgeSerializer.addTreeEdge(g, config32, fevc32);
-               
+
                TransactionalGraphEngine spy = spy(dbEngine);
                TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
 
@@ -296,72 +296,72 @@ public class MigrateHUBEvcInventoryTest extends AAISetup {
                when(spy.asAdmin()).thenReturn(adminSpy);
                when(adminSpy.getTraversalSource()).thenReturn(traversal);
                when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
-               
+
                migration = new MigrateHUBEvcInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
                migration.run();
        }
-       
+
        @AfterEach
        public void cleanUp() {
                tx.tx().rollback();
                graph.close();
        }
-       
+
        @Test
        public void testRun_checkFevc1AndFevc2AreUpdated() throws Exception {
-               
+
                // check if forwarder-evc nodes get updated
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("aai-node-type", "forwarder-evc")
                                .has("forwarder-evc-id", "evc-name-1-1")
                                .has("ivlan","4054")
-                               .hasNext(), 
+                               .hasNext(),
                                "forwarder-evc evc-name-1-1 updated with ivlan");
-               
-               assertEquals(true, 
+
+               assertEquals(true,
                                g.V().has("aai-node-type", "forwarder-evc")
                                .has("forwarder-evc-id", "evc-name-2-2")
                                .has("ivlan","4084")
-                               .hasNext(), 
+                               .hasNext(),
                                "forwarder-evc evc-name-2-2 updated with ivlan");
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("aai-node-type", "forwarder-evc")
                                .has("forwarder-evc-id", "evc-name-2-3")
                                .has("ivlan","4054")
-                               .hasNext(), 
+                               .hasNext(),
                                "forwarder-evc evc-name-2-3 updated with ivlan");
-               
-               assertEquals(new Long(4L), 
+
+               assertEquals(new Long(4L),
                                g.V().has("forwarding-path-id", "evc-name-2")
                                .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder")
                                .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration")
                                .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder-evc")
-                               .count().next(), 
+                               .count().next(),
                                "4 forwarder-evcs exist for evc evc-name-2");
-               
-               assertEquals(new Long(3L), 
+
+               assertEquals(new Long(3L),
                                g.V().has("forwarding-path-id", "evc-name-2")
                                .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder")
                                .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration")
                                .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "forwarder-evc")
                                .has("forwarder-evc-id").has("ivlan")
-                               .count().next(), 
+                               .count().next(),
                                "3 forwarder-evcs updated for evc evc-name-2");
-               
-               assertEquals(false, 
+
+               assertEquals(false,
                                g.V().has("aai-node-type", "forwarder-evc")
                                .has("forwarder-evc-id", "evc-name-3-1")
                                .has("ivlan")
-                               .hasNext(), 
+                               .hasNext(),
                                "forwarder-evc evc-name-3-1 updated with ivlan");
        }
 
-       
+
        @Test
        public void testGetAffectedNodeTypes() {
                Optional<String[]> types = migration.getAffectedNodeTypes();
                Optional<String[]> expected = Optional.of(new String[]{"forwarder-evc"});
-               
+
                assertNotNull(types);
                assertArrayEquals(expected.get(), types.get());
        }
index f54dae0..028cc22 100644 (file)
@@ -64,8 +64,8 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
                                loader);
 
                System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
-               
-               
+
+
                Vertex pnf1 = g.addV()
                                .property("aai-node-type", "pnf")
                                .property("pnf-name", "pnf-name-1")
@@ -77,7 +77,7 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
                                .property("aai-uri", "/network/pnfs/pnf/pnf-name-1/p-interfaces/pinterface/1.1")
                                .next();
                // graph 1
-                               
+
                edgeSerializer.addTreeEdge(g, pnf1, port11);
 
 
@@ -90,11 +90,11 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
                when(spy.asAdmin()).thenReturn(adminSpy);
                when(adminSpy.getTraversalSource()).thenReturn(traversal);
                when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
-               
+
                migration = new MigrateINVPhysicalInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
                migration.run();
        }
-       
+
        @AfterEach
        public void cleanUp() {
                tx.tx().rollback();
@@ -123,21 +123,21 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
        @Test
        public void testRun_checkPnfsAndPInterfacesExist() throws Exception {
                // check if graph nodes exist
-               
+
                // check if pnf node gets created
-               assertEquals(new Long(2L), 
+               assertEquals(new Long(2L),
                                g.V().has("aai-node-type", "pnf")
-                               .count().next(), 
+                               .count().next(),
                                "2 PNFs exist");
-               
+
                System.out.println("cOUNT:" +g.V().has("aai-node-type", "pnf")
                                .has("pnf-name", "pnf-name-collector-1").in("tosca.relationships.network.BindsTo").count().next());
-                               
+
                assertEquals(new Long(1L),
                                g.V().has("aai-node-type", "pnf")
                                .has("pnf-name", "pnf-name-collector-1").count().next(),
                                "p-interfaces created for pnfs");
-               
+
                assertEquals(true,
                                g.V().has("aai-node-type", "pnf")
                                .has("pnf-name", "pnf-name-collector-1")
@@ -151,12 +151,12 @@ public class MigrateINVPhysicalInventoryTest extends AAISetup {
                                .in("tosca.relationships.network.BindsTo").count().next(),
                                "p-interfaces created for pnfs");
        }
-       
+
        @Test
        public void testGetAffectedNodeTypes() {
                Optional<String[]> types = migration.getAffectedNodeTypes();
                Optional<String[]> expected = Optional.of(new String[]{"pnf"});
-               
+
                assertNotNull(types);
                assertArrayEquals(expected.get(), types.get());
        }
index dcc49c0..0a0bfcc 100644 (file)
@@ -65,17 +65,17 @@ public class MigrateInvEvcInventoryTest extends AAISetup {
                                loader);
 
                System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
-               
+
                Vertex evc = g.addV()
                                .property("aai-node-type", "evc")
                                .property("evc-id", "evc-name-1")
                                .next();
-               
+
                Vertex evc2 = g.addV()
                                .property("aai-node-type", "evc")
                                .property("evc-id", "evc-name-2")
                                .next();
-               
+
                TransactionalGraphEngine spy = spy(dbEngine);
                TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
 
@@ -85,59 +85,59 @@ public class MigrateInvEvcInventoryTest extends AAISetup {
                when(spy.asAdmin()).thenReturn(adminSpy);
                when(adminSpy.getTraversalSource()).thenReturn(traversal);
                when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
-               
+
                migration = new MigrateINVEvcInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
                migration.run();
        }
-       
+
        @AfterEach
        public void cleanUp() {
                tx.tx().rollback();
                graph.close();
        }
-       
+
        @Test
        public void testRun_updateEvcNode() throws Exception {
                // check if graph nodes exist
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("aai-node-type", "evc")
                                         .has("evc-id", "evc-name-1")
-                               .hasNext(), 
+                               .hasNext(),
                                "evc node exists");
-               
+
                // check if evc object is updated to set the value for inter-connect-type-ingress
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-1")
                                .has("inter-connect-type-ingress", "SHARED")
-                               .hasNext(), 
+                               .hasNext(),
                                "evc is updated");
        }
-       
+
        @Test
        public void testRun_evcNotCreated() throws Exception {
-               
-               assertEquals(false, 
+
+               assertEquals(false,
                                g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-3")
-                               .hasNext(), 
+                               .hasNext(),
                                "evc node does not exist");
-               
+
                //inter-connect-type-ingress is not present on the evc
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-2")
-                               .hasNext(), 
+                               .hasNext(),
                                "evc node exists");
-               assertEquals(false, 
+               assertEquals(false,
                                g.V().has("aai-node-type", "evc").has("evc-id", "evc-name-2").has("inter-connect-type-ingress")
-                               .hasNext(), 
+                               .hasNext(),
                                "evc node not updated with inter-connect-type-ingress");
-               
+
        }
 
        @Test
        public void testGetAffectedNodeTypes() {
                Optional<String[]> types = migration.getAffectedNodeTypes();
                Optional<String[]> expected = Optional.of(new String[]{"evc"});
-               
+
                assertNotNull(types);
                assertArrayEquals(expected.get(), types.get());
        }
index 7511f8c..03f7f8f 100644 (file)
@@ -33,11 +33,9 @@ import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import org.onap.aai.AAISetup;
-import org.onap.aai.dbmap.DBConnectionType;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
index 2b46026..ecf45f7 100644 (file)
@@ -66,59 +66,59 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                                loader);
 
                System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
-               
+
                Vertex customer1 = g.addV()
                                .property("aai-node-type", "customer")
                                .property("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .property("subscriber-type", "CUST")
                                .next();
-               
+
                Vertex servSub1 = g.addV()
                                .property("aai-node-type", "service-subscription")
                                .property("service-type", "SAREA")
                                .next();
-               
+
                Vertex servInst1 = g.addV()
                                .property("aai-node-type", "service-instance")
                                .property("service-instance-id", "evc-name-1")
                                .next();
-               
+
                Vertex customer2 = g.addV()
                                .property("aai-node-type", "customer")
                                .property("global-customer-id", "cust-1")
                                .property("subscriber-type", "CUST")
                                .next();
-               
+
                Vertex servSub2 = g.addV()
                                .property("aai-node-type", "service-subscription")
                                .property("service-type", "SAREA")
                                .next();
-               
+
                Vertex servInst2 = g.addV()
                                .property("aai-node-type", "service-instance")
                                .property("service-instance-id", "evc-name-1")
                                .next();
-               
+
                Vertex collectorPnf = g.addV()
                                .property("aai-node-type", "pnf")
                                .property("pnf-name", "pnf-name-collector-1")
                                .next();
-               
+
                Vertex bearerPnf = g.addV()
                                .property("aai-node-type", "pnf")
                                .property("pnf-name", "pnf-name-bearer-1")
                                .next();
-               
+
                Vertex collectorPort = g.addV()
                                .property("aai-node-type", "p-interface")
                                .property("interface-name", "p-int-collector-1")
                                .next();
-               
+
                Vertex bearerPort = g.addV()
                                .property("aai-node-type", "p-interface")
                                .property("interface-name", "p-int-bearer-1")
                                .next();
-               
+
                Vertex servInst4 = g.addV()
                                .property("aai-node-type", "service-instance")
                                .property("service-instance-id", "evc-name-4")
@@ -142,11 +142,11 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                when(spy.asAdmin()).thenReturn(adminSpy);
                when(adminSpy.getTraversalSource()).thenReturn(traversal);
                when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
-               
+
                migration = new MigrateSAREvcInventory(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
                migration.run();
        }
-       
+
        @AfterEach
        public void cleanUp() {
                tx.tx().rollback();
@@ -157,25 +157,25 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
        @Test
        public void testRun_createServiceInstanceNode() throws Exception {
                // check if graph nodes exist
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("service-instance-id", "evc-name-1")
-                               .hasNext(), 
+                               .hasNext(),
                                "service instance node exists");
-               
+
                // check if service-instance node gets created
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("service-instance-id", "evc-name-1")
                                .out("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
-                               .hasNext(), 
+                               .hasNext(),
                                "service subscription node, service-type=SAREA");
-               
-       
-               
+
+
+
                // check if fowarding-path node gets created
                assertEquals(true, g.V().has("forwarding-path-id", "evc-name-1")
                                .has("forwarding-path-name", "evc-name-1").hasNext(), "fowarding-path is created");
-               
-               assertEquals(true, 
+
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1")
@@ -183,9 +183,9 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                                .has("aai-node-type", "forwarding-path")
                                .has("forwarding-path-id", "evc-name-1")
                                .has("forwarding-path-name", "evc-name-1")
-                               .hasNext(), 
+                               .hasNext(),
                                "fowarding-path node exists");
-               
+
                // check if configuration node gets created
                assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
@@ -197,20 +197,20 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                                .has("configuration-sub-type", "evc")
                                .hasNext(),
                                "configuration node, configuration-type= forwarding-path");
-               
+
                //check if evc node gets created
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1")
                                .in("org.onap.relationships.inventory.AppliesTo").has("aai-node-type", "forwarding-path")
                                .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration")
                                .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "evc")
-                               .hasNext(), 
+                               .hasNext(),
                                "evc is created");
-               
+
                // check if evc node gets created
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1")
@@ -223,57 +223,57 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                                .has("cir-units", "Mbps")
                                .has("tagmode-access-ingress", "DOUBLE")
                                .has("tagmode-access-egress", "DOUBLE")
-                               .hasNext(), 
+                               .hasNext(),
                                "configuration node, configuration-type= evc");
        }
 
        @Test
        public void testRun_evcNotCreated() throws Exception {
                // check if graph nodes exist
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
-                               .hasNext(), 
+                               .hasNext(),
                                "customer node exists");
-               
-               assertEquals(true, 
+
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
-                               .hasNext(), 
+                               .hasNext(),
                                "service subscription node, service-type=SAREA");
-               
+
                //service-instance should not be created
-               assertEquals(false, 
+               assertEquals(false,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-2")
-                               .hasNext(), 
+                               .hasNext(),
                                "service instance node created");
-               
-               assertEquals(true, 
+
+               assertEquals(true,
                                g.V().has("global-customer-id", "cust-1")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1")
-                               .hasNext(), 
+                               .hasNext(),
                                "service instance node already exists");
-               
+
                // fowarding-path node should not be created
                assertEquals(false, g.V().has("aai-node-type", "forwarding-path")
                                .has("forwarding-path-name", "evc-name-2").hasNext(), "fowarding-path created");
-               
+
                // configuration node should not be created
                assertEquals(false, g.V().has("aai-node-type", "configuration")
                                .has("configuration-id", "evc-name-2").hasNext(), "configuration node created");
-               
+
                // evc node should not be created
                assertEquals(false, g.V().has("aai-node-type", "evc")
                                .has("evc-id", "evc-name-2").hasNext(), "evc node created");
-               
+
                // service-instance is not created because pnf exists, but p-interface does not
-               assertEquals(false, 
+               assertEquals(false,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-3")
-                               .hasNext(), 
+                               .hasNext(),
                                "service instance node created");
        }
 
@@ -281,25 +281,25 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
        @Test
        public void testRun_createFPConfigurationEvcNode4() throws Exception {
                // check if graph nodes exist
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("service-instance-id", "evc-name-4")
-                               .hasNext(), 
+                               .hasNext(),
                                "service instance node exists");
-               
+
                // check if service-instance node gets created
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("service-instance-id", "evc-name-4")
                                .out("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
-                               .hasNext(), 
+                               .hasNext(),
                                "service subscription node, service-type=SAREA");
-               
-       
-               
+
+
+
                // check if fowarding-path node gets created
                assertEquals(true, g.V().has("forwarding-path-id", "evc-name-4")
                                .has("forwarding-path-name", "evc-name-4").hasNext(), "fowarding-path is created");
-               
-               assertEquals(true, 
+
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-4")
@@ -307,9 +307,9 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                                .has("aai-node-type", "forwarding-path")
                                .has("forwarding-path-id", "evc-name-4")
                                .has("forwarding-path-name", "evc-name-4")
-                               .hasNext(), 
+                               .hasNext(),
                                "fowarding-path node exists");
-               
+
                // check if configuration node gets created
                assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
@@ -321,20 +321,20 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                                .has("configuration-sub-type", "evc")
                                .hasNext(),
                                "configuration node, configuration-type= forwarding-path");
-               
+
                //check if evc node gets created
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-4")
                                .in("org.onap.relationships.inventory.AppliesTo").has("aai-node-type", "forwarding-path")
                                .out("org.onap.relationships.inventory.Uses").has("aai-node-type", "configuration")
                                .in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "evc")
-                               .hasNext(), 
+                               .hasNext(),
                                "evc is created");
-               
+
                // check if evc node gets created
-               assertEquals(true, 
+               assertEquals(true,
                                g.V().has("global-customer-id", "8a00890a-e6ae-446b-9dbe-b828dbeb38bd")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-type", "SAREA")
                                .in("org.onap.relationships.inventory.BelongsTo").has("service-instance-id", "evc-name-1")
@@ -347,15 +347,15 @@ public class MigrateSAREvcInventoryTest extends AAISetup {
                                .has("cir-units", "Mbps")
                                .has("tagmode-access-ingress", "DOUBLE")
                                .has("tagmode-access-egress", "DOUBLE")
-                               .hasNext(), 
+                               .hasNext(),
                                "configuration node, configuration-type= evc");
        }
-       
+
        @Test
        public void testGetAffectedNodeTypes() {
                Optional<String[]> types = migration.getAffectedNodeTypes();
                Optional<String[]> expected = Optional.of(new String[]{"service-instance"});
-               
+
                assertNotNull(types);
                assertArrayEquals(expected.get(), types.get());
        }
index e8f7cda..b6894b5 100644 (file)
@@ -162,4 +162,4 @@ public class UriMigrationTest extends AAISetup {
                migration.seen.add(pInterface3.id());
                assertEquals(Collections.EMPTY_SET, migration.getChildren(lInterface3));
        }
-}
\ No newline at end of file
+}
index cf96574..e0ff99e 100644 (file)
@@ -19,7 +19,7 @@
  */
 package org.onap.aai.migration.v13;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -74,14 +74,14 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup {
        }
 
        private void createFirstVertexAndRelatedVertexes() throws AAIException {
-               
+
                // Add model1/model-ver1 -- invalid model/model-ver
                Vertex model1 = g.addV().property("aai-node-type", "model")
                                .property("model-invariant-id", "model-invariant-id-1").property("model-type", "widget").next();
                modelVer1 = g.addV().property("aai-node-type", "model-ver").property("model-version-id", "model-version-id-1")
                                .property("model-name", "connector").property("model-version", "v1.0").next();
                edgeSerializer.addTreeEdge(g, model1, modelVer1);
-               
+
                // Add named-query and named-query-element nodes.  Point the named-query-element at model1
                Vertex namedQ1 = g.addV().property("aai-node-type", "named-query")
                .property("named-query-uuid", "named-query-uuid-1").property("named-query-name", "test-NQ-1").next();
@@ -123,9 +123,9 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup {
                assertEquals(true,
                                g.V().has("aai-node-type", "named-query-element").has("named-query-element-uuid", "named-query-element-uuid-1")
                                                .out("org.onap.relationships.inventory.BelongsTo")
-                                               .has("named-query-uuid", "named-query-uuid-1").hasNext());      
+                                               .has("named-query-uuid", "named-query-uuid-1").hasNext());
        }
-       
+
        @Test
        public void testBadNodesAreNotGone() {
                assertEquals(true,
@@ -133,16 +133,16 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup {
                assertEquals(true,
                                g.V().has("aai-node-type", "model").has("model-invariant-id", "model-invariant-id-1").hasNext());
        }
-       
+
        @Test
        public void testNQNodesaAreStillThere() {
                assertEquals(true,
                                g.V().has("aai-node-type", "named-query").has("named-query-uuid", "named-query-uuid-1").hasNext());
                assertEquals(true,
                                g.V().has("aai-node-type", "named-query-element").has("named-query-element-uuid", "named-query-element-uuid-1").hasNext());
-               
+
        }
-       
+
 
        @Test
        public void testThatNewEdgeAdded() {
@@ -159,7 +159,7 @@ public class MigrateBadWidgetModelsPartOneTest extends AAISetup {
                                                .in("org.onap.relationships.inventory.IsA").has("named-query-element-uuid", "named-query-element-uuid-1")
                                                .hasNext());
        }
-       
-       
 
-}
\ No newline at end of file
+
+
+}
index f50e037..9602f4b 100644 (file)
@@ -19,7 +19,7 @@
  */
 package org.onap.aai.migration.v13;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -132,13 +132,13 @@ public class MigrateBadWidgetModelsPartTwoTest extends AAISetup {
                                                .out("org.onap.relationships.inventory.BelongsTo").has("model-version-id", "model-version-id-2")
                                                .hasNext());
        }
-       
+
        @Test
        public void testBadVerNodeIsGoneX() {
                assertEquals(false,
                                g.V().has("aai-node-type", "model-ver").has("model-version-id", "model-version-id-1").hasNext());
        }
-       
+
        @Test
        public void testBadModelNodeIsGoneX() {
                assertEquals(false,
@@ -161,4 +161,4 @@ public class MigrateBadWidgetModelsPartTwoTest extends AAISetup {
                                                .hasNext());
        }
 
-}
\ No newline at end of file
+}
index f4c3a28..eb679c4 100644 (file)
@@ -122,7 +122,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
         g.addV().property("aai-node-type", "vserver")\r
                        .property("vserver-id", "vserver3")\r
                        .property("is-closed-loop-disabled", false)\r
-                       .next();        \r
+                       .next();\r
       //l3-network\r
         g.addV().property("aai-node-type", "l3-network")\r
                 .property("network-id", "l3-network0")\r
@@ -151,7 +151,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                        .property("is-provider-network", false)\r
                                .property("is-shared-network", false)\r
                                .property("is-external-network", false)\r
-                       .next();       \r
+                       .next();\r
         //subnet\r
         g.addV().property("aai-node-type", "subnet")\r
                 .property("subnet-id", "subnet0")\r
@@ -190,7 +190,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                        .property("in-maint", false)\r
                                .property("is-port-mirrored", false)\r
                                .property("is-ip-unnumbered", false)\r
-                       .next(); \r
+                       .next();\r
       //vf-module\r
         g.addV().property("aai-node-type", "vf-module")\r
                 .property("vf-module-id", "vf-module0")\r
@@ -205,9 +205,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 .next();\r
         g.addV().property("aai-node-type", "vf-module")\r
                        .property("vf-module-id", "vf-module3")\r
-                               .property("is-base-vf-module", false)                           \r
-                       .next(); \r
-                     \r
+                               .property("is-base-vf-module", false)\r
+                       .next();\r
+\r
       //vlan\r
         g.addV().property("aai-node-type", "vlan")\r
                 .property("vlan-interface", "vlan0")\r
@@ -222,9 +222,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 .next();\r
         g.addV().property("aai-node-type", "vlan")\r
                        .property("vlan-interface", "vlan3")\r
-                               .property("is-ip-unnumbered", false)                            \r
+                               .property("is-ip-unnumbered", false)\r
                        .next();\r
-        \r
+\r
         TransactionalGraphEngine spy = spy(dbEngine);\r
         TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());\r
         GraphTraversalSource traversal = g;\r
@@ -232,7 +232,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
         when(adminSpy.getTraversalSource()).thenReturn(traversal);\r
         migration = new BooleanDefaultMigrator(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);\r
         migration.run();\r
-        \r
+\r
     }\r
 \r
     @Test\r
@@ -249,28 +249,28 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of subnet should be updated since the property dhcp-enabled doesn't exist");\r
         //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");  \r
+                "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-provider-network doesn't exist");  \r
+                "Value of l3-network should be updated since the property is-provider-network doesn't exist");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-shared-network doesn't exist");  \r
+                "Value of l3-network should be updated since the property is-shared-network doesn't exist");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-external-network doesn't exist"); \r
+                "Value of l3-network should be updated since the property is-external-network doesn't exist");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),\r
-                "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");  \r
+                "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");\r
                //vf-module: is-base-vf-module\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),\r
-                "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");  \r
+                "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");\r
     }\r
 \r
     @Test\r
-    public void testEmptyValue() {                         \r
+    public void testEmptyValue() {\r
       //is-closed-loop-disabled\r
         assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),\r
                 "Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");\r
@@ -283,26 +283,26 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of subnet should be updated since the value for dhcp-enabled is an empty string");\r
         //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext(),\r
-                               "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");         \r
+                               "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext(),\r
-                               "Value of l3-network should be updated since the value for is-provider-network is an empty string");        \r
+                               "Value of l3-network should be updated since the value for is-provider-network is an empty string");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext(),\r
                                "Value of l3-network should be updated since the value for is-shared-network is an empty string");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext(),\r
                                "Value of l3-network should be updated since the value for is-external-network is an empty string");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),\r
-                "Value of l-interface should be updated since the property is-port-mirrored  is an empty string");  \r
+                "Value of l-interface should be updated since the property is-port-mirrored  is an empty string");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of l-interface should be updated since the property is-ip-unnumbered  is an empty string");\r
                //vf-module: is-base-vf-module, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),\r
-                "Value of vf-module should be updated since the property is-base-vf-module  is an empty string");  \r
+                "Value of vf-module should be updated since the property is-base-vf-module  is an empty string");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of vlan should be updated since the property is-ip-unnumbered is an empty string");\r
     }\r
-    \r
+\r
     @Test\r
     public void testExistingTrueValues() {\r
       //is-closed-loop-disabled\r
@@ -314,7 +314,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");\r
        //dhcp-enabled\r
         assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),\r
-                "Value of subnet shouldn't be update since dhcp-enabled already exists"); \r
+                "Value of subnet shouldn't be update since dhcp-enabled already exists");\r
       //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext(),\r
                                "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");\r
@@ -323,21 +323,21 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext(),\r
                                "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-external-network already exists");                           \r
+                               "Value of l3-network shouldn't be updated since is-external-network already exists");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),\r
-                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");  \r
+                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),\r
-                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");           \r
+                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");\r
                //vf-module: is-base-vf-module\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),\r
-                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");  \r
+                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),\r
                 "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
-        \r
+\r
     }\r
-    \r
+\r
     @Test\r
     public void testExistingFalseValues() {\r
        //is-closed-loop-disabled\r
@@ -352,23 +352,23 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of subnet shouldn't be update since dhcp-enabled already exists");\r
         //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");  \r
+                               "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-provider-network already exists");  \r
+                               "Value of l3-network shouldn't be updated since is-provider-network already exists");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext(),\r
                                "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-external-network already exists");                   \r
+                               "Value of l3-network shouldn't be updated since is-external-network already exists");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),\r
-                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");  \r
+                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),\r
-                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");                           \r
+                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");\r
                //vf-module: is-base-vf-module\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),\r
-                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");  \r
+                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
-    } \r
-}
\ No newline at end of file
+    }\r
+}\r
index 9bb413b..0952bd7 100644 (file)
@@ -54,7 +54,7 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup {
                dbEngine = new JanusGraphDBEngine(
                                queryStyle,
                                loader);
-               
+
                System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
 
                Vertex pnf1 = g.addV().property("aai-node-type", "pnf").property("pnf-name", "pnf-1").next();
@@ -79,8 +79,8 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup {
                                .property("forwarder-role",  "ingress").next();
                Vertex forwarder5 = g.addV().property("aai-node-type", "forwarder").property("sequence", 1)
                                .property("forwarder-role",  "ingress").next();
-               
-               
+
+
                Vertex configuration1 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-1")
                                .property("configuration-type", "test").property("configuration-subt-type", "test").next();
                Vertex configuration2 = g.addV().property("aai-node-type", "configuration").property("configuration-id", "config-2")
@@ -102,30 +102,30 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup {
                Vertex forwarderEvc4 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-4")
                                .property("circuit-id", "3").property("resource-version", "v13").next();
                Vertex forwarderEvc5 = g.addV().property("aai-node-type", "forwarder-evc").property("forwarder-evc-id", "evc-5")
-                               .property("resource-version", "v13").next();            
-               
+                               .property("resource-version", "v13").next();
+
+
 
-               
                edgeSerializer.addTreeEdge(g, pnf1, pInterface1);
                edgeSerializer.addEdge(g, pInterface1, forwarder1);
                edgeSerializer.addEdge(g, forwarder1, configuration1);
                edgeSerializer.addTreeEdge(g, configuration1, forwarderEvc1);
-               
+
                edgeSerializer.addTreeEdge(g, pnf2, pInterface2);
                edgeSerializer.addEdge(g, pInterface2, forwarder2);
                edgeSerializer.addEdge(g, forwarder2, configuration2);
                edgeSerializer.addTreeEdge(g, configuration2, forwarderEvc2);
-               
+
                edgeSerializer.addTreeEdge(g, pnf3, pInterface3);
                edgeSerializer.addEdge(g, pInterface3, forwarder3);
                edgeSerializer.addEdge(g, forwarder3, configuration3);
                edgeSerializer.addTreeEdge(g, configuration3, forwarderEvc3);
-               
+
                edgeSerializer.addTreeEdge(g, pnf4, pInterface4);
                edgeSerializer.addEdge(g, pInterface4, forwarder4);
                edgeSerializer.addEdge(g, forwarder4, configuration4);
                edgeSerializer.addTreeEdge(g, configuration4, forwarderEvc4);
-               
+
                edgeSerializer.addTreeEdge(g, pnf5, pInterface5);
                edgeSerializer.addEdge(g, pInterface5, forwarder5);
                edgeSerializer.addEdge(g, forwarder5, configuration5);
@@ -140,39 +140,39 @@ public class MigrateForwarderEvcCircuitIdTest extends AAISetup {
                when(spy.asAdmin()).thenReturn(adminSpy);
                when(adminSpy.getTraversalSource()).thenReturn(traversal);
                when(adminSpy.getReadOnlyTraversalSource()).thenReturn(readOnly);
-               
+
                migration = new MigrateForwarderEvcCircuitId(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
                migration.run();
        }
-       
+
        @Test
        public void testCircuitIdsUpdated() throws Exception {
                // check if graph nodes are updated
-               
-               assertEquals("10", 
-                               g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "10").next().value("circuit-id").toString(), 
+
+               assertEquals("10",
+                               g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "10").next().value("circuit-id").toString(),
                                "First circuit-id updated");
 
-               assertEquals("20", 
-                               g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "20").next().value("circuit-id").toString(), 
+               assertEquals("20",
+                               g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "20").next().value("circuit-id").toString(),
                                "Second circuit-id updated");
 
                assertFalse(g.V().has("aai-node-type", "forwarder-evc").has("forwarder-evc-id", "evc-3")
                                .next().property("circuit-id").isPresent(), "Third circuit-id remains empty");
 
-               assertEquals("3", 
-                               g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "3").next().value("circuit-id").toString(), 
+               assertEquals("3",
+                               g.V().has("aai-node-type", "forwarder-evc").has("circuit-id", "3").next().value("circuit-id").toString(),
                                "Fourth circuit-id not updated");
 
                assertFalse(g.V().has("aai-node-type", "forwarder-evc").has("forwarder-evc-id", "evc-5")
                                .next().property("circuit-id").isPresent(), "Fifth circuit-id remains empty");
        }
-       
+
        @Test
        public void testGetAffectedNodeTypes() {
                Optional<String[]> types = migration.getAffectedNodeTypes();
                Optional<String[]> expected = Optional.of(new String[]{"forwarder-evc"});
-               
+
                assertNotNull(types);
                assertArrayEquals(expected.get(), types.get());
        }
index 6e906ca..28e993e 100644 (file)
@@ -23,10 +23,7 @@ import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.serialization.db.EdgeSerializer;\r
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;\r
 \r
-import org.janusgraph.core.JanusGraph;\r
-import org.janusgraph.core.JanusGraphFactory;\r
 import org.janusgraph.core.JanusGraphTransaction;\r
-import org.janusgraph.core.schema.JanusGraphManagement;\r
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;\r
 import org.junit.jupiter.api.BeforeEach;\r
 import org.junit.jupiter.api.Test;\r
index dab9077..2a0981f 100644 (file)
@@ -36,7 +36,7 @@ import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
index eef65ac..776bb45 100644 (file)
@@ -104,4 +104,4 @@ public class MigrateInstanceGroupSubTypeTest extends AAISetup{
                assertFalse(instanceGroupWithoutTSubType.property(MigrateInstanceGroupSubType.INSTANCE_GROUP_ROLE_PROPERTY).isPresent());
                assertFalse(instanceGroupWithoutTSubType.property(MigrateInstanceGroupSubType.SUB_TYPE_PROPERTY).isPresent());
        }
-}
\ No newline at end of file
+}
index d0b93d6..b4106fb 100644 (file)
@@ -67,12 +67,12 @@ public class MigrateInstanceGroupTypeTest extends AAISetup{
                 queryStyle,
                 loader);
          instanceGroup = g.addV().property("aai-node-type", MigrateInstanceGroupType.INSTANCE_GROUP_NODE_TYPE)
-                .property( MigrateInstanceGroupType.TYPE_PROPERTY, TYPE_VALUE)                
+                .property( MigrateInstanceGroupType.TYPE_PROPERTY, TYPE_VALUE)
                 .next();
-         
+
          instanceGroupWithoutType = g.addV().property("aai-node-type", MigrateInstanceGroupType.INSTANCE_GROUP_NODE_TYPE)
                  .next();
-         
+
         TransactionalGraphEngine spy = spy(dbEngine);
         TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
         GraphTraversalSource traversal = g;
@@ -104,4 +104,4 @@ public class MigrateInstanceGroupTypeTest extends AAISetup{
         assertFalse(instanceGroupWithoutType.property(MigrateInstanceGroupType.INSTANCE_GROUP_TYPE_PROPERTY).isPresent());
         assertFalse(instanceGroupWithoutType.property(MigrateInstanceGroupType.TYPE_PROPERTY).isPresent());
     }
-}
\ No newline at end of file
+}
index 41f524b..74b9e0f 100644 (file)
@@ -19,7 +19,7 @@
  */
 package org.onap.aai.migration.v13;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -34,12 +34,10 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 import org.onap.aai.AAISetup;
-import org.onap.aai.dbmap.DBConnectionType;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.LoaderFactory;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
index 7272176..25b46ad 100644 (file)
@@ -71,11 +71,11 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{
          pserver1 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PSERVER_NODE_TYPE)
                 .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "Server")
                 .next();
-         
+
          pserver2 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PSERVER_NODE_TYPE)
                  .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "server")
                  .next();
-         
+
          pnf1 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PNF_NODE_TYPE)
                  .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "Switch")
                  .next();
@@ -86,7 +86,7 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{
          pserver3 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PSERVER_NODE_TYPE)
                  .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "server1")
                  .next();
-         
+
          pnf2 = g.addV().property("aai-node-type", MigratePserverAndPnfEquipType.PNF_NODE_TYPE)
                  .property( MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY, "Switch1")
                  .next();
@@ -119,15 +119,15 @@ public class MigratePServerAndPnfEquipTypeTest extends AAISetup{
         assertEquals("SWITCH",pnf1.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value());
         assertEquals("SWITCH",pnf22.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value());
     }
-    
+
     @Test
     public void verifyEquipTypeIsNotChanged() {
        assertEquals("server1",pserver3.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value());
         assertEquals("Switch1",pnf2.property(MigratePserverAndPnfEquipType.EQUIP_TYPE_PROPERTY).value());
     }
-    
-    
-    
 
 
-}
\ No newline at end of file
+
+
+
+}
index 066b2c8..d6bbad2 100644 (file)
@@ -41,7 +41,7 @@ import static org.mockito.Mockito.when;
 import java.util.Optional;
 
 public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
-       
+
        protected static final String VNF_NODE_TYPE = "generic-vnf";
 
        public static class MigrateVnfType extends MigrateGenericVnfMgmtOptions {
@@ -92,7 +92,7 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
                 .property("vnf-type", "HN")
                 .property("management-option", "existingOption")
                 .next();
-        
+
         g.addV().property("aai-node-type", "generic-vnf")
                        .property("vnf-id", "generic-vnf10")
                        .property("vnf-type", "HP")
@@ -107,7 +107,7 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
                        .property("vnf-type", "HP")
                        .property("management-option", "existingOption")
                        .next();
-        
+
         g.addV().property("aai-node-type", "generic-vnf")
                                .property("vnf-id", "generic-vnf20")
                                .property("vnf-type", "HG")
@@ -121,8 +121,8 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
                                .property("vnf-id", "generic-vnf22")
                                .property("vnf-type", "HG")
                                .property("management-option", "existingOption")
-                               .next();        
-        
+                               .next();
+
         // Non-eligible migration conditions - vnf-type = XX
         g.addV().property("aai-node-type", "generic-vnf")
                        .property("vnf-id", "generic-vnf30")
@@ -137,7 +137,7 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
                                .property("vnf-id", "generic-vnf32")
                                .property("vnf-type", "XX")
                                .property("management-option", "existingOption")
-                               .next(); 
+                               .next();
         // Non-eligible migration conditions - vnf-type = missing
         g.addV().property("aai-node-type", "generic-vnf")
                        .property("vnf-id", "generic-vnf40")
@@ -149,8 +149,8 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
         g.addV().property("aai-node-type", "generic-vnf")
                                .property("vnf-id", "generic-vnf42")
                                .property("management-option", "existingOption")
-                               .next(); 
-        
+                               .next();
+
         TransactionalGraphEngine spy = spy(dbEngine);
         TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
         GraphTraversalSource traversal = g;
@@ -158,22 +158,22 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
         when(adminSpy.getTraversalSource()).thenReturn(traversal);
         migration = new MigrateVnfType(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);
         migration.run();
-        
+
     }
 
     @Test
     public void testMissingProperty(){
        //management-option
         assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf0").has("management-option", "AT&T Managed-Basic").hasNext(),
-                "Value of generic-vnf should be updated since the property management-option doesn't exist");      
+                "Value of generic-vnf should be updated since the property management-option doesn't exist");
         assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf10").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf  should be updated since the property management-option doesn't exist");
         assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf20").has("management-option", "AT&T Managed-Basic").hasNext(),
-                "Value of generic-vnf  should be updated since the property management-option doesn't exist");              
+                "Value of generic-vnf  should be updated since the property management-option doesn't exist");
     }
 
     @Test
-    public void testEmptyValue() {                         
+    public void testEmptyValue() {
       //management-option
         assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf should be updated since the value for management-option is an empty string");
@@ -181,9 +181,9 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
                 "Value of generic-vnf should be updated since the value for management-option is an empty string");
         assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf21").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf should be updated since the value for management-option is an empty string");
-    
+
     }
-    
+
     @Test
     public void testExistingValues() {
       //management-option
@@ -193,10 +193,10 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
                 "Value of generic-vnf shouldn't be updated since management-option already exists");
         assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf22").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf shouldn't be updated since management-option already exists");
-       
-        
+
+
     }
-    
+
    @Test
     public void testExistingVnfsNotMigrated() {
        //management-option
@@ -206,13 +206,13 @@ public class MigrateGenericVnfMgmtOptionsTest extends AAISetup {
                 "Value of generic-vnf  shouldn't be updated since vnf-type is not affected");
         assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf32").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf  shouldn't be updated since vnf-type is not affected and management-option already exists");
-        
+
         assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf40").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf shouldn't be updated since vnf-type is not present");
         assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf41").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf  shouldn't be updated since vnf-type is not present");
         assertTrue(!g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf42").has("management-option", "AT&T Managed-Basic").hasNext(),
                 "Value of generic-vnf  shouldn't be updated since vnf-type is not present and management-option already exists");
-      
-    } 
-}
\ No newline at end of file
+
+    }
+}
index a652147..99f2509 100644 (file)
@@ -19,7 +19,8 @@
  */
 package org.onap.aai.migration.v14;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -33,10 +34,8 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.dbmap.DBConnectionType;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.ModelType;
-import org.onap.aai.migration.v14.MigrateSameSourcedRCTROPserverData;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
index 03d8464..512d9f2 100644 (file)
  */
 package org.onap.aai.migration.v14;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphFactory;
 import org.janusgraph.core.JanusGraphTransaction;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 import org.onap.aai.AAISetup;
 import org.onap.aai.db.props.AAIProperties;
-import org.onap.aai.dbmap.DBConnectionType;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.serialization.engines.JanusGraphDBEngine;
index 60e6b04..27d8ff2 100644 (file)
  */
 package org.onap.aai.migration.v14;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
-import java.util.List;
-
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -32,7 +30,6 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.dbmap.DBConnectionType;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.serialization.engines.QueryStyle;
index 116e773..a465fed 100644 (file)
@@ -122,7 +122,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
         g.addV().property("aai-node-type", "vserver")\r
                        .property("vserver-id", "vserver3")\r
                        .property("is-closed-loop-disabled", false)\r
-                       .next();        \r
+                       .next();\r
       //l3-network\r
         g.addV().property("aai-node-type", "l3-network")\r
                 .property("network-id", "l3-network0")\r
@@ -151,7 +151,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                        .property("is-provider-network", false)\r
                                .property("is-shared-network", false)\r
                                .property("is-external-network", false)\r
-                       .next();       \r
+                       .next();\r
         //subnet\r
         g.addV().property("aai-node-type", "subnet")\r
                 .property("subnet-id", "subnet0")\r
@@ -190,7 +190,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                        .property("in-maint", false)\r
                                .property("is-port-mirrored", false)\r
                                .property("is-ip-unnumbered", false)\r
-                       .next(); \r
+                       .next();\r
       //vf-module\r
         g.addV().property("aai-node-type", "vf-module")\r
                 .property("vf-module-id", "vf-module0")\r
@@ -205,9 +205,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 .next();\r
         g.addV().property("aai-node-type", "vf-module")\r
                        .property("vf-module-id", "vf-module3")\r
-                               .property("is-base-vf-module", false)                           \r
-                       .next(); \r
-                     \r
+                               .property("is-base-vf-module", false)\r
+                       .next();\r
+\r
       //vlan\r
         g.addV().property("aai-node-type", "vlan")\r
                 .property("vlan-interface", "vlan0")\r
@@ -222,9 +222,9 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 .next();\r
         g.addV().property("aai-node-type", "vlan")\r
                        .property("vlan-interface", "vlan3")\r
-                               .property("is-ip-unnumbered", false)                            \r
+                               .property("is-ip-unnumbered", false)\r
                        .next();\r
-        \r
+\r
         TransactionalGraphEngine spy = spy(dbEngine);\r
         TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());\r
         GraphTraversalSource traversal = g;\r
@@ -232,7 +232,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
         when(adminSpy.getTraversalSource()).thenReturn(traversal);\r
         migration = new BooleanDefaultMigrator(spy, loaderFactory, edgeIngestor, edgeSerializer, schemaVersions);\r
         migration.run();\r
-        \r
+\r
     }\r
 \r
     @Test\r
@@ -249,28 +249,28 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of subnet should be updated since the property dhcp-enabled doesn't exist");\r
         //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-bound-to-vpn", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");  \r
+                "Value of l3-network should be updated since the property is-bound-to-vpn doesn't exist");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-provider-network", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-provider-network doesn't exist");  \r
+                "Value of l3-network should be updated since the property is-provider-network doesn't exist");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-shared-network", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-shared-network doesn't exist");  \r
+                "Value of l3-network should be updated since the property is-shared-network doesn't exist");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network0").has("network-name", "l3-network-name0").has("is-external-network", false).hasNext(),\r
-                "Value of l3-network should be updated since the property is-external-network doesn't exist"); \r
+                "Value of l3-network should be updated since the property is-external-network doesn't exist");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-port-mirrored", false).hasNext(),\r
-                "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");  \r
+                "Value of l-interface should be updated since the property is-port-mirrored doesn't exist");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface0").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of l-interface should be updated since the property is-ip-unnumbered doesn't exist");\r
                //vf-module: is-base-vf-module\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module0").has("is-base-vf-module", false).hasNext(),\r
-                "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");  \r
+                "Value of vf-module should be updated since the property is-base-vf-module doesn't exist");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan0").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of vlan should be updated since the property is-ip-unnumbered doesn't exist");\r
     }\r
 \r
     @Test\r
-    public void testEmptyValue() {                         \r
+    public void testEmptyValue() {\r
       //is-closed-loop-disabled\r
         assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("is-closed-loop-disabled", false).hasNext(),\r
                 "Value of generic-vnf should be updated since the value for is-closed-loop-disabled is an empty string");\r
@@ -283,26 +283,26 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of subnet should be updated since the value for dhcp-enabled is an empty string");\r
         //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-bound-to-vpn", false).hasNext(),\r
-                               "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");         \r
+                               "Value of l3-network should be updated since the value for is-bound-to-vpn is an empty string");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-provider-network", false).hasNext(),\r
-                               "Value of l3-network should be updated since the value for is-provider-network is an empty string");        \r
+                               "Value of l3-network should be updated since the value for is-provider-network is an empty string");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-shared-network", false).hasNext(),\r
                                "Value of l3-network should be updated since the value for is-shared-network is an empty string");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network1").has("network-name", "l3-network-name1").has("is-external-network", false).hasNext(),\r
                                "Value of l3-network should be updated since the value for is-external-network is an empty string");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-port-mirrored", false).hasNext(),\r
-                "Value of l-interface should be updated since the property is-port-mirrored  is an empty string");  \r
+                "Value of l-interface should be updated since the property is-port-mirrored  is an empty string");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of l-interface should be updated since the property is-ip-unnumbered  is an empty string");\r
                //vf-module: is-base-vf-module, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module1").has("is-base-vf-module", false).hasNext(),\r
-                "Value of vf-module should be updated since the property is-base-vf-module  is an empty string");  \r
+                "Value of vf-module should be updated since the property is-base-vf-module  is an empty string");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan1").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of vlan should be updated since the property is-ip-unnumbered is an empty string");\r
     }\r
-    \r
+\r
     @Test\r
     public void testExistingTrueValues() {\r
       //is-closed-loop-disabled\r
@@ -314,7 +314,7 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of vserver shouldn't be update since is-closed-loop-disabled already exists");\r
        //dhcp-enabled\r
         assertTrue(g.V().has("aai-node-type", "subnet").has("subnet-id", "subnet2").has("dhcp-enabled", true).hasNext(),\r
-                "Value of subnet shouldn't be update since dhcp-enabled already exists"); \r
+                "Value of subnet shouldn't be update since dhcp-enabled already exists");\r
       //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-bound-to-vpn", true).hasNext(),\r
                                "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");\r
@@ -323,21 +323,21 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-shared-network", true).hasNext(),\r
                                "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network2").has("network-name", "l3-network-name2").has("is-external-network", true).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-external-network already exists");                           \r
+                               "Value of l3-network shouldn't be updated since is-external-network already exists");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-port-mirrored", true).hasNext(),\r
-                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");  \r
+                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface2").has("is-ip-unnumbered", true).hasNext(),\r
-                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");           \r
+                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");\r
                //vf-module: is-base-vf-module\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module2").has("is-base-vf-module", true).hasNext(),\r
-                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");  \r
+                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan2").has("is-ip-unnumbered", true).hasNext(),\r
                 "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
-        \r
+\r
     }\r
-    \r
+\r
     @Test\r
     public void testExistingFalseValues() {\r
        //is-closed-loop-disabled\r
@@ -352,23 +352,23 @@ public class MigrateBooleanDefaultsToFalseTest extends AAISetup {
                 "Value of subnet shouldn't be update since dhcp-enabled already exists");\r
         //l3-network: is-bound-to-vpn, is-shared-network, is-external-network\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-bound-to-vpn", false).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");  \r
+                               "Value of l3-network shouldn't be updated since is-bound-to-vpn already exists");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-provider-network", false).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-provider-network already exists");  \r
+                               "Value of l3-network shouldn't be updated since is-provider-network already exists");\r
         assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-shared-network", false).hasNext(),\r
                                "Value of l3-network shouldn't be updated since is-shared-network already exists");\r
                assertTrue(g.V().has("aai-node-type", "l3-network").has("network-id", "l3-network3").has("network-name", "l3-network-name3").has("is-external-network", false).hasNext(),\r
-                               "Value of l3-network shouldn't be updated since is-external-network already exists");                   \r
+                               "Value of l3-network shouldn't be updated since is-external-network already exists");\r
                //l-interface: is-port-mirrored, is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-port-mirrored", false).hasNext(),\r
-                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");  \r
+                "Value of l-interface shouldn't be updated since is-port-mirrored already exists");\r
                assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface3").has("is-ip-unnumbered", false).hasNext(),\r
-                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");                           \r
+                "Value of ll-interface shouldn't be updated since is-ip-unnumbered already exists");\r
                //vf-module: is-base-vf-module\r
                assertTrue(g.V().has("aai-node-type", "vf-module").has("vf-module-id", "vf-module3").has("is-base-vf-module", false).hasNext(),\r
-                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");  \r
+                "Value of vf-module shouldn't be updated since is-base-vf-module already exists");\r
                //vlan: is-ip-unnumbered\r
                assertTrue(g.V().has("aai-node-type", "vlan").has("vlan-interface", "vlan3").has("is-ip-unnumbered", false).hasNext(),\r
                 "Value of vlan shouldn't be updated since is-ip-unnumbered already exists");\r
-    } \r
-}
\ No newline at end of file
+    }\r
+}\r
index 0ecbcfa..8f33f4c 100644 (file)
@@ -54,11 +54,11 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{
     Vertex cloudRegion1;
     Vertex cloudRegion2;
     Vertex cloudRegion3;
-   
+
 
     @BeforeEach
     public void setUp() throws Exception {
-       
+
        graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
         tx = graph.newTransaction();
         g = tx.traversal();
@@ -66,27 +66,27 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{
         dbEngine = new JanusGraphDBEngine(
                 queryStyle,
                 loader);
-        
+
         System.setProperty("BUNDLECONFIG_DIR", "src/test/resources");
-               
+
         cloudRegion1 = g.addV().property("aai-node-type", MigrateCloudRegionUpgradeCycle.CLOUD_REGION_NODE_TYPE)
                        .property(MigrateCloudRegionUpgradeCycle.CLOUD_REGION_ID, "akr1")
                        .property(MigrateCloudRegionUpgradeCycle.CLOUD_OWNER, "att-aic")
                 .property( MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE, "Test")
                 .next();
-         
+
          cloudRegion2 = g.addV().property("aai-node-type", MigrateCloudRegionUpgradeCycle.CLOUD_REGION_NODE_TYPE)
                         .property(MigrateCloudRegionUpgradeCycle.CLOUD_REGION_ID, "amsnl1b")
                         .property(MigrateCloudRegionUpgradeCycle.CLOUD_OWNER, "att-aic")
                  //.property( MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE, "server")
                  .next();
-         
+
          cloudRegion3 = g.addV().property("aai-node-type", MigrateCloudRegionUpgradeCycle.CLOUD_REGION_NODE_TYPE)
                         .property(MigrateCloudRegionUpgradeCycle.CLOUD_REGION_ID, "alp1")
                         .property(MigrateCloudRegionUpgradeCycle.CLOUD_OWNER, "Test")
                  .property( MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE, "server1")
                  .next();
-        
+
         TransactionalGraphEngine spy = spy(dbEngine);
         TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
         GraphTraversalSource traversal = g;
@@ -114,4 +114,4 @@ public class MigrateCloudRegionUpgradeCycleTest extends AAISetup{
         assertEquals("B",cloudRegion2.property(MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE).value());
         assertEquals("server1",cloudRegion3.property(MigrateCloudRegionUpgradeCycle.UPGRADE_CYCLE).value());//Not changed
     }
-}
\ No newline at end of file
+}
index ccd8c95..b657ef6 100644 (file)
@@ -31,15 +31,12 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.dbmap.DBConnectionType;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.setup.SchemaVersions;
-import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import org.janusgraph.core.JanusGraphFactory;
 import org.janusgraph.core.JanusGraph;
 import org.janusgraph.core.JanusGraphTransaction;
 
index 971a174..e115b97 100644 (file)
@@ -24,23 +24,20 @@ import static org.mockito.Mockito.when;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.onap.aai.config.WebClientConfiguration;
-import org.onap.aai.restclient.PropertyPasswordConfiguration;
 import org.onap.aai.service.SchemaJobStatusService;
 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.boot.test.mock.mockito.MockBean;
 import org.springframework.context.annotation.Import;
-import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.web.reactive.server.WebTestClient;
 
 
 @Import(WebClientConfiguration.class)
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
 public class SchemaJobStatusControllerTest {
 
-    @MockBean 
+    @MockBean
     private SchemaJobStatusService schemaJobStatusService;
 
     @Autowired
@@ -58,7 +55,7 @@ public class SchemaJobStatusControllerTest {
     @Test
     void testIsSchemaInitializedTrue() throws Exception {
         when(schemaJobStatusService.isSchemaInitialized()).thenReturn(true);
-       
+
         webClient.get()
                .uri("/isSchemaInitialized")
                .exchange()
@@ -70,7 +67,7 @@ public class SchemaJobStatusControllerTest {
     @Test
     void testIsSchemaInitializedFalse() throws Exception {
         when(schemaJobStatusService.isSchemaInitialized()).thenReturn(false);
-       
+
         webClient.get()
                .uri("/isSchemaInitialized")
                .exchange()
@@ -87,4 +84,4 @@ public class SchemaJobStatusControllerTest {
                 .expectStatus()
                 .isNotFound();
     }
-}
\ No newline at end of file
+}
index fb310c7..af6ba46 100644 (file)
@@ -154,7 +154,7 @@ public class EchoResponseTest extends AAISetup {
         assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
     }
 
-    
+
     @Test
     public void testCheckDbNowAction_Unknown() {
        when(aaiGraphCheckerMock.isAaiGraphDbAvailable()).thenReturn(null);
@@ -163,4 +163,4 @@ public class EchoResponseTest extends AAISetup {
         assertNotNull(response);
         assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus());
     }
-}
\ No newline at end of file
+}
index 1e6088e..f85c97a 100644 (file)
@@ -78,3 +78,7 @@ management.endpoints.web.exposure.include=info, health, loggers, prometheus
 management.metrics.web.server.auto-time-requests=false
 
 aai.notifications.enabled=false
+
+aai.basic-auth.enabled=true
+aai.basic-auth.users[0].username=AAI
+aai.basic-auth.users[0].password=AAI
index 6129e4a..73ddb41 100644 (file)
@@ -5,7 +5,7 @@
 
 major_version=1
 minor_version=15
-patch_version=4
+patch_version=5
 
 base_version=${major_version}.${minor_version}.${patch_version}