aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:14:34 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:24:59 -0400
commitf47919f1fe367b612fa9c96d34c59f01a541e882 (patch)
tree5b6aa2fc36747d868897e68ccbec0c6db0aee81c /adapters/mso-catalog-db-adapter
parent54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff)
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules Added in eclipse java formatting xml Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0 Issue-ID: SO-1765 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/db/migration/CloudConfig.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java108
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java22
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java15
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java32
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java29
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java112
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java57
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java84
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java215
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java47
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java31
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java116
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java169
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java193
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java170
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java396
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java12
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java22
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java1535
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java15
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java18
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java192
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java15
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java12
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java234
32 files changed, 1906 insertions, 1977 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/CloudConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/CloudConfig.java
index 82139f21af..6a0bec5f08 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/CloudConfig.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/CloudConfig.java
@@ -25,13 +25,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
-
import java.util.HashMap;
import java.util.Map;
/**
- * @deprecated
- * This class is introduced as deprecated as its only purpose is for migration of cloud config data. It shouldnt be used elsewhere.
+ * @deprecated This class is introduced as deprecated as its only purpose is for migration of cloud config data. It
+ * shouldnt be used elsewhere.
*/
@Deprecated
@@ -71,12 +70,12 @@ public class CloudConfig {
this.cloudifyManagers = cloudifyManagers;
}
- public void populateId(){
+ public void populateId() {
for (Map.Entry<String, CloudIdentity> entry : identityServices.entrySet()) {
entry.getValue().setId(entry.getKey());
}
- for (Map.Entry <String, CloudSite> entry : cloudSites.entrySet()) {
+ for (Map.Entry<String, CloudSite> entry : cloudSites.entrySet()) {
entry.getValue().setId(entry.getKey());
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
index c20acaf967..053c6da1cb 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -35,7 +35,6 @@ import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -48,56 +47,57 @@ import java.sql.Statement;
import java.util.Collection;
/**
- * Performs migration using JDBC Connection from the cloud config provided in the environment (application-{profile}.yaml) and persist data (when not already present) to the catalod database.
+ * Performs migration using JDBC Connection from the cloud config provided in the environment
+ * (application-{profile}.yaml) and persist data (when not already present) to the catalod database.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
-public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoProvider, MigrationChecksumProvider {
+public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProvider, MigrationChecksumProvider {
public static final String FLYWAY = "FLYWAY";
private static final Logger logger = LoggerFactory.getLogger(R__CloudConfigMigration.class);
@JsonProperty("cloud_config")
private CloudConfig cloudConfig;
-
+
@Override
- public boolean isUndo(){
- return false;
+ public boolean isUndo() {
+ return false;
}
@Override
public void migrate(Connection connection) throws Exception {
logger.debug("Starting migration for CloudConfig");
-
+
CloudConfig cloudConfig = null;
-
+
String tableQuery = "SELECT * FROM identity_services";
int totalRetries = 20;
boolean tableExists = false;
int count = 1;
- while(!tableExists && count != totalRetries) {
- try(Statement stmt = connection.createStatement();) {
- stmt.executeQuery(tableQuery);
- tableExists = true;
+ while (!tableExists && count != totalRetries) {
+ try (Statement stmt = connection.createStatement();) {
+ stmt.executeQuery(tableQuery);
+ tableExists = true;
} catch (SQLException e) {
- count++;
- // Wait 5 mintues
- Thread.sleep(300000);
+ count++;
+ // Wait 5 mintues
+ Thread.sleep(300000);
}
}
-
+
// Try the override file
String configLocation = System.getProperty("spring.config.additional-location");
if (configLocation != null) {
try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) {
cloudConfig = loadCloudConfig(stream);
- }catch(Exception e){
+ } catch (Exception e) {
logger.warn("Error Loading override.yaml", e);
- }
+ }
}
-
+
if (cloudConfig == null) {
logger.debug("No CloudConfig defined in {}", configLocation);
- // Try the application.yaml file
+ // Try the application.yaml file
try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) {
cloudConfig = loadCloudConfig(stream);
}
@@ -106,8 +106,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
logger.debug("No CloudConfig defined in {}", getApplicationYamlName());
}
}
-
- if(cloudConfig != null){
+
+ if (cloudConfig != null) {
migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
@@ -122,32 +122,35 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
this.cloudConfig = cloudConfig;
}
- private CloudConfig loadCloudConfig(InputStream stream) throws IOException {
- ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
- R__CloudConfigMigration cloudConfigMigration =
- mapper.readValue(stream, R__CloudConfigMigration.class);
+ private CloudConfig loadCloudConfig(InputStream stream) throws IOException {
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ R__CloudConfigMigration cloudConfigMigration = mapper.readValue(stream, R__CloudConfigMigration.class);
CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
- if(cloudConfig != null){
- cloudConfig.populateId();
+ if (cloudConfig != null) {
+ cloudConfig.populateId();
}
return cloudConfig;
}
private String getApplicationYamlName() {
- String profile = System.getProperty("spring.profiles.active") == null ? "" : "-" + System.getProperty("spring.profiles.active");
+ String profile = System.getProperty("spring.profiles.active") == null ? ""
+ : "-" + System.getProperty("spring.profiles.active");
return "/application" + profile + ".yaml";
}
- private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws SQLException {
+ private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws SQLException {
logger.debug("Starting migration for CloudConfig-->IdentityService");
- String insert = "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`) " +
- "VALUES (?,?,?,?,?,?,?,?,?,?);";
+ String insert =
+ "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`) "
+ + "VALUES (?,?,?,?,?,?,?,?,?,?);";
- try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) {
+ try (Statement stmt = connection.createStatement();
+ PreparedStatement ps = connection.prepareStatement(insert)) {
for (CloudIdentity cloudIdentity : entities) {
- try (ResultSet rows = stmt.executeQuery("Select count(1) from identity_services where id='" + cloudIdentity.getId() + "'")) {
+ try (ResultSet rows = stmt.executeQuery(
+ "Select count(1) from identity_services where id='" + cloudIdentity.getId() + "'")) {
int count = 0;
while (rows.next()) {
count = rows.getInt(1);
@@ -160,8 +163,14 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
ps.setString(5, cloudIdentity.getAdminTenant());
ps.setString(6, cloudIdentity.getMemberRole());
ps.setBoolean(7, cloudIdentity.getTenantMetadata());
- ps.setString(8, cloudIdentity.getIdentityServerType() != null ? cloudIdentity.getIdentityServerType().name() : null);
- ps.setString(9, cloudIdentity.getIdentityAuthenticationType() != null ? cloudIdentity.getIdentityAuthenticationType().name() : null);
+ ps.setString(8,
+ cloudIdentity.getIdentityServerType() != null
+ ? cloudIdentity.getIdentityServerType().name()
+ : null);
+ ps.setString(9,
+ cloudIdentity.getIdentityAuthenticationType() != null
+ ? cloudIdentity.getIdentityAuthenticationType().name()
+ : null);
ps.setString(10, FLYWAY);
ps.executeUpdate();
}
@@ -170,14 +179,17 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
}
}
- private void migrateCloudSite(Collection<CloudSite> entities, Connection connection) throws SQLException {
+ private void migrateCloudSite(Collection<CloudSite> entities, Connection connection) throws SQLException {
logger.debug("Starting migration for CloudConfig-->CloudSite");
- String insert = "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) " +
- "VALUES (?,?,?,?,?,?,?,?,?);";
+ String insert =
+ "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) "
+ + "VALUES (?,?,?,?,?,?,?,?,?);";
- try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) {
+ try (Statement stmt = connection.createStatement();
+ PreparedStatement ps = connection.prepareStatement(insert)) {
for (CloudSite cloudSite : entities) {
- try (ResultSet rows = stmt.executeQuery("Select count(1) from cloud_sites where id='" + cloudSite.getId() + "'")) {
+ try (ResultSet rows =
+ stmt.executeQuery("Select count(1) from cloud_sites where id='" + cloudSite.getId() + "'")) {
int count = 0;
while (rows.next()) {
count = rows.getInt(1);
@@ -199,13 +211,17 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
}
}
- private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws SQLException {
- String insert = "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)" +
- " VALUES (?,?,?,?,?,?);";
+ private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection)
+ throws SQLException {
+ String insert =
+ "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)"
+ + " VALUES (?,?,?,?,?,?);";
- try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) {
+ try (Statement stmt = connection.createStatement();
+ PreparedStatement ps = connection.prepareStatement(insert)) {
for (CloudifyManager cloudifyManager : entities) {
- try (ResultSet rows = stmt.executeQuery("Select count(1) from cloudify_managers where id='" + cloudifyManager.getId() + "'")) {
+ try (ResultSet rows = stmt.executeQuery(
+ "Select count(1) from cloudify_managers where id='" + cloudifyManager.getId() + "'")) {
int count = 0;
while (rows.next()) {
count = rows.getInt(1);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
index 374e597116..a0a0756d3d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
@@ -25,23 +25,25 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client","org.onap.so.logging.jaxrs.filter","org.onap.so.logging.spring.interceptor","org.onap.so.client","org.onap.so.configuration"})
+@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client",
+ "org.onap.so.logging.jaxrs.filter", "org.onap.so.logging.spring.interceptor", "org.onap.so.client",
+ "org.onap.so.configuration"})
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
@EntityScan("org.onap.so.db.catalog.beans")
public class CatalogDBApplication {
-
- private static final String LOGS_DIR = "logs_dir";
- private static void setLogsDir() {
- if (System.getProperty(LOGS_DIR) == null) {
- System.getProperties().setProperty(LOGS_DIR, "./logs/catdb/");
- }
- }
-
+ private static final String LOGS_DIR = "logs_dir";
+
+ private static void setLogsDir() {
+ if (System.getProperty(LOGS_DIR) == null) {
+ System.getProperties().setProperty(LOGS_DIR, "./logs/catdb/");
+ }
+ }
+
public static void main(String[] args) {
SpringApplication.run(CatalogDBApplication.class, args);
System.getProperties().setProperty("mso.db", "MARIADB");
- System.getProperties().setProperty("server.name", "Springboot");
+ System.getProperties().setProperty("server.name", "Springboot");
setLogsDir();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java
index 3906762e60..fdec7cf5d6 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java
@@ -21,9 +21,7 @@
package org.onap.so.adapters.catalogdb;
import java.util.stream.Collectors;
-
import javax.persistence.EntityManager;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
@@ -32,12 +30,13 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapt
@Configuration
public class CatalogDbRepositoryConfiguration extends RepositoryRestConfigurerAdapter {
- @Autowired
- private EntityManager entityManager;
+ @Autowired
+ private EntityManager entityManager;
- @Override
- public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
- config.exposeIdsFor(entityManager.getMetamodel().getEntities().stream().map(e -> e.getJavaType()).collect(Collectors.toList()).toArray(new Class[0]));
- }
+ @Override
+ public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
+ config.exposeIdsFor(entityManager.getMetamodel().getEntities().stream().map(e -> e.getJavaType())
+ .collect(Collectors.toList()).toArray(new Class[0]));
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index ff162c862e..db73d4afec 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -22,12 +22,10 @@ package org.onap.so.adapters.catalogdb;
import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
-
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.springframework.context.annotation.Configuration;
-
import io.swagger.jaxrs.config.BeanConfig;
import io.swagger.jaxrs.listing.ApiListingResource;
import io.swagger.jaxrs.listing.SwaggerSerializers;
@@ -36,20 +34,20 @@ import io.swagger.jaxrs.listing.SwaggerSerializers;
@ApplicationPath("/ecomp/mso/catalog")
public class JerseyConfiguration extends ResourceConfig {
- @PostConstruct
- public void setUp() {
- register(CatalogDbAdapterRest.class);
- register(ApiListingResource.class);
- register(SwaggerSerializers.class);
- register(JaxRsFilterLogging.class);
- BeanConfig beanConfig = new BeanConfig();
- beanConfig.setVersion("1.0.2");
- beanConfig.setSchemes(new String[]{"http"});
- beanConfig.setHost("localhost:8080");
- beanConfig.setBasePath("/ecomp/mso/catalog");
- beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb");
- beanConfig.setPrettyPrint(true);
- beanConfig.setScan(true);
- }
+ @PostConstruct
+ public void setUp() {
+ register(CatalogDbAdapterRest.class);
+ register(ApiListingResource.class);
+ register(SwaggerSerializers.class);
+ register(JaxRsFilterLogging.class);
+ BeanConfig beanConfig = new BeanConfig();
+ beanConfig.setVersion("1.0.2");
+ beanConfig.setSchemes(new String[] {"http"});
+ beanConfig.setHost("localhost:8080");
+ beanConfig.setBasePath("/ecomp/mso/catalog");
+ beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb");
+ beanConfig.setPrettyPrint(true);
+ beanConfig.setScan(true);
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
index efe6010f23..4dabb58f7d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
@@ -36,7 +36,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Bean
public MappedInterceptor mappedLoggingInterceptor() {
- return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor);
+ return new MappedInterceptor(new String[] {"/**"}, loggingInterceptor);
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java
index 2eb4858803..1d58975e6b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java
@@ -33,21 +33,18 @@ import org.springframework.util.StringUtils;
@EnableWebSecurity
public class WebSecurityConfigImpl extends WebSecurityConfig {
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.csrf().disable()
- .authorizeRequests()
- .antMatchers("/manage/health","/manage/info").permitAll()
- .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),","))
- .and()
- .httpBasic();
- }
-
- @Override
- public void configure(WebSecurity web) throws Exception {
- super.configure(web);
- StrictHttpFirewall firewall = new MSOSpringFirewall();
- web.httpFirewall(firewall);
- }
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ super.configure(web);
+ StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
index cc1b3ddb17..edec48dc95 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -29,68 +29,70 @@ import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class CatalogQuery {
- protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class);
- private static final boolean IS_EMBED = true;
+ protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class);
+ private static final boolean IS_EMBED = true;
- public abstract String JSON2(boolean isArray, boolean isEmbed);
+ public abstract String JSON2(boolean isArray, boolean isEmbed);
- protected void put(Map<String, String> valueMap, String key, String value) {
- valueMap.put(key, value == null? "null": '"'+ value+ '"');
- }
+ protected void put(Map<String, String> valueMap, String key, String value) {
+ valueMap.put(key, value == null ? "null" : '"' + value + '"');
+ }
- protected void put(Map<String, String> valueMap, String key, Integer value) {
- valueMap.put(key, value == null? "null": value.toString());
- }
+ protected void put(Map<String, String> valueMap, String key, Integer value) {
+ valueMap.put(key, value == null ? "null" : value.toString());
+ }
- protected void put(Map<String, String> valueMap, String key, Boolean value) {
- valueMap.put(key, value == null? "null": value? "true": "false");
- }
+ protected void put(Map<String, String> valueMap, String key, Boolean value) {
+ valueMap.put(key, value == null ? "null" : value ? "true" : "false");
+ }
- protected String setTemplate(String template, Map<String, String> valueMap) {
- StringBuffer result = new StringBuffer();
+ protected String setTemplate(String template, Map<String, String> valueMap) {
+ StringBuffer result = new StringBuffer();
- String pattern = "<.*>";
- Pattern r = Pattern.compile(pattern);
- Matcher m = r.matcher(template);
+ String pattern = "<.*>";
+ Pattern r = Pattern.compile(pattern);
+ Matcher m = r.matcher(template);
- logger.debug("CatalogQuery template: {}", template);
- while (m.find()) {
- String key = template.substring(m.start() + 1, m.end() - 1);
- logger.debug("CatalogQuery key: {} contains key? {}", key , valueMap.containsKey(key));
- m.appendReplacement(result, Matcher.quoteReplacement(valueMap.getOrDefault(key, "\"TBD\"")));
- }
- m.appendTail(result);
- logger.debug("CatalogQuery return: {}", result.toString());
- return result.toString();
- }
+ logger.debug("CatalogQuery template: {}", template);
+ while (m.find()) {
+ String key = template.substring(m.start() + 1, m.end() - 1);
+ logger.debug("CatalogQuery key: {} contains key? {}", key, valueMap.containsKey(key));
+ m.appendReplacement(result, Matcher.quoteReplacement(valueMap.getOrDefault(key, "\"TBD\"")));
+ }
+ m.appendTail(result);
+ logger.debug("CatalogQuery return: {}", result.toString());
+ return result.toString();
+ }
- /**
- * The simple, clean, generic way to handle the interface
- */
- protected String smartToJSON() {
- String jsonString = null;
- try {
- ObjectMapper mapper = new ObjectMapper();
- jsonString = mapper.writeValueAsString(this);
- }
- catch (Exception e) {
- logger.error("Error converting to JSON" , e);
- jsonString = "invalid"; //throws instead?
- }
- return jsonString;
- }
+ /**
+ * The simple, clean, generic way to handle the interface
+ */
+ protected String smartToJSON() {
+ String jsonString = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ jsonString = mapper.writeValueAsString(this);
+ } catch (Exception e) {
+ logger.error("Error converting to JSON", e);
+ jsonString = "invalid"; // throws instead?
+ }
+ return jsonString;
+ }
- public String toJsonString(String version, boolean isArray) {
- switch(version) {
- case "v1": return smartToJSON();
- case "v2": return JSON2(isArray, !IS_EMBED);
- default:
- return "invalid version: "+ version;
- }
- }
- @Override
- public String toString(){
- return smartToJSON();
-
- }
+ public String toJsonString(String version, boolean isArray) {
+ switch (version) {
+ case "v1":
+ return smartToJSON();
+ case "v2":
+ return JSON2(isArray, !IS_EMBED);
+ default:
+ return "invalid version: " + version;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return smartToJSON();
+
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java
index 890347344c..f47c9006c6 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java
@@ -21,7 +21,6 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import java.io.Serializable;
-
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "catalogQueryException")
@@ -29,30 +28,46 @@ public class CatalogQueryException extends CatalogQueryExceptionCommon implement
private static final long serialVersionUID = -9062290006520066109L;
private String message;
- private CatalogQueryExceptionCategory category;
- private Boolean rolledBack;
+ private CatalogQueryExceptionCategory category;
+ private Boolean rolledBack;
+
+ public CatalogQueryException() {}
+
+ public CatalogQueryException(String message) {
+ this.message = message;
+ }
+
+ public CatalogQueryException(String message, CatalogQueryExceptionCategory category, boolean rolledBack,
+ String messageid) {
+ super(messageid);
+ this.message = message;
+ this.category = category;
+ this.rolledBack = rolledBack;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
- public CatalogQueryException () {}
+ public CatalogQueryExceptionCategory getCategory() {
+ return category;
+ }
- public CatalogQueryException (String message) {
- this.message = message;
- }
+ public void setCategory(CatalogQueryExceptionCategory category) {
+ this.category = category;
+ }
- public CatalogQueryException (String message, CatalogQueryExceptionCategory category, boolean rolledBack, String messageid) {
- super(messageid);
- this.message = message;
- this.category = category;
- this.rolledBack = rolledBack;
- }
+ public Boolean getRolledBack() {
+ return rolledBack;
+ }
- public String getMessage() { return message; }
- public void setMessage(String message) { this.message = message; }
+ public void setRolledBack(Boolean rolledBack) {
+ this.rolledBack = rolledBack;
+ }
- public CatalogQueryExceptionCategory getCategory () { return category; }
- public void setCategory (CatalogQueryExceptionCategory category) { this.category = category; }
- public Boolean getRolledBack() { return rolledBack; }
- public void setRolledBack(Boolean rolledBack) { this.rolledBack = rolledBack; }
-
-
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java
index 687cc7d3e0..d22c865555 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java
@@ -20,4 +20,6 @@
package org.onap.so.adapters.catalogdb.catalogrest;
-public enum CatalogQueryExceptionCategory { OPENSTACK, IO, INTERNAL, USERDATA }
+public enum CatalogQueryExceptionCategory {
+ OPENSTACK, IO, INTERNAL, USERDATA
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
index 283fef1d3b..324ac073a8 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
@@ -24,54 +24,62 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import java.io.ByteArrayOutputStream;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
public abstract class CatalogQueryExceptionCommon {
- private String messageId;
- protected static Logger logger = LoggerFactory.getLogger(CatalogQueryExceptionCommon.class);
+ private String messageId;
+ protected static Logger logger = LoggerFactory.getLogger(CatalogQueryExceptionCommon.class);
+
+ public CatalogQueryExceptionCommon() {
+ messageId = null;
+ }
+
+ public CatalogQueryExceptionCommon(String messageId) {
+ this.messageId = messageId;
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
- public CatalogQueryExceptionCommon() { messageId = null; }
- public CatalogQueryExceptionCommon(String messageId) { this.messageId = messageId; }
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
- public String getMessageId() { return messageId; }
- public void setMessageId(String messageId) { this.messageId = messageId; }
+ public String toJsonString() {
+ try {
+ String jsonString;
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ jsonString = mapper.writeValueAsString(this);
+ return jsonString;
+ } catch (Exception e) {
+ logger.error("Exception:", e);
+ return "";
+ }
+ }
- public String toJsonString() {
- try {
- String jsonString;
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
- jsonString = mapper.writeValueAsString(this);
- return jsonString;
- } catch (Exception e) {
- logger.error ("Exception:", e);
- return "";
- }
- }
+ public String toXmlString() {
+ try {
+ ByteArrayOutputStream bs = new ByteArrayOutputStream();
+ JAXBContext context = JAXBContext.newInstance(this.getClass());
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty print XML
+ marshaller.marshal(this, bs);
+ return bs.toString();
+ } catch (Exception e) {
+ logger.error("Exception:", e);
+ return "";
+ }
+ }
- public String toXmlString() {
- try {
- ByteArrayOutputStream bs = new ByteArrayOutputStream();
- JAXBContext context = JAXBContext.newInstance(this.getClass());
- Marshaller marshaller = context.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML
- marshaller.marshal(this, bs);
- return bs.toString();
- } catch (Exception e) {
- logger.error ("Exception:", e);
- return "";
- }
- }
-
- @Override
- public String toString(){
- return toJsonString();
- }
+ @Override
+ public String toString() {
+ return toJsonString();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index 859666f446..e550394931 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -32,116 +32,113 @@ import org.slf4j.LoggerFactory;
@XmlRootElement(name = "serviceAllottedResources")
public class QueryAllottedResourceCustomization extends CatalogQuery {
protected static Logger logger = LoggerFactory.getLogger(QueryAllottedResourceCustomization.class);
- private List<AllottedResourceCustomization> allottedResourceCustomization;
- private static final String TEMPLATE =
- "\t{\n"+
- "\t\t\"modelInfo\" : {\n"+
- "\t\t\t\"modelName\" : <MODEL_NAME>,\n"+
- "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+
- "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"+
- "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"+
- "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>,\n"+
- "\t\t\t\"modelInstanceName\" : <MODEL_INSTANCE_NAME>\n"+
- "\t\t},\n"+
- "\t\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"+
- "\t\t\"allottedResourceType\" : <ALLOTTED_RESOURCE_TYPE>,\n"+
- "\t\t\"allottedResourceRole\" : <ALLOTTED_RESOURCE_ROLE>,\n"+
- "\t\t\"providingServiceModelName\" : <PROVIDING_SERVICE_MODEL_NAME>,\n"+
- "\t\t\"providingServiceModelInvariantUuid\" : <PROVIDING_SERVICE_MODEL_INVARIANT_UUID>,\n"+
- "\t\t\"providingServiceModelUuid\" : <PROVIDING_SERVICE_MODEL_UUID>,\n"+
- "\t\t\"nfFunction\" : <NF_FUNCTION>,\n"+
- "\t\t\"nfType\" : <NF_TYPE>,\n"+
- "\t\t\"nfRole\" : <NF_ROLE>,\n"+
- "\t\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"+
- "\t\t\"resourceInput\" : <RESOURCE_INPUT>\n"+
- "\t}";
-
- public QueryAllottedResourceCustomization() {
- super();
- allottedResourceCustomization = new ArrayList<>();
- }
-
- public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) {
- allottedResourceCustomization = vlist;
- }
-
- public List<AllottedResourceCustomization> getServiceAllottedResources(){
- return this.allottedResourceCustomization;
- }
-
- public void setServiceAllottedResources(List<AllottedResourceCustomization> v) {
- this.allottedResourceCustomization = v;
- }
-
- @Override
- public String toString () {
- StringBuilder sb = new StringBuilder();
-
- boolean first = true;
- int i = 1;
- for (AllottedResourceCustomization o : allottedResourceCustomization) {
- sb.append(i).append("\t");
- if (!first)
- sb.append("\n");
-
- first = false;
- sb.append(o);
- }
- return sb.toString();
+ private List<AllottedResourceCustomization> allottedResourceCustomization;
+ private static final String TEMPLATE =
+ "\t{\n" + "\t\t\"modelInfo\" : {\n" + "\t\t\t\"modelName\" : <MODEL_NAME>,\n"
+ + "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>,\n"
+ + "\t\t\t\"modelInstanceName\" : <MODEL_INSTANCE_NAME>\n" + "\t\t},\n"
+ + "\t\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"
+ + "\t\t\"allottedResourceType\" : <ALLOTTED_RESOURCE_TYPE>,\n"
+ + "\t\t\"allottedResourceRole\" : <ALLOTTED_RESOURCE_ROLE>,\n"
+ + "\t\t\"providingServiceModelName\" : <PROVIDING_SERVICE_MODEL_NAME>,\n"
+ + "\t\t\"providingServiceModelInvariantUuid\" : <PROVIDING_SERVICE_MODEL_INVARIANT_UUID>,\n"
+ + "\t\t\"providingServiceModelUuid\" : <PROVIDING_SERVICE_MODEL_UUID>,\n"
+ + "\t\t\"nfFunction\" : <NF_FUNCTION>,\n"
+ + "\t\t\"nfType\" : <NF_TYPE>,\n"
+ + "\t\t\"nfRole\" : <NF_ROLE>,\n"
+ + "\t\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"
+ + "\t\t\"resourceInput\" : <RESOURCE_INPUT>\n" + "\t}";
+
+ public QueryAllottedResourceCustomization() {
+ super();
+ allottedResourceCustomization = new ArrayList<>();
+ }
+
+ public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) {
+ allottedResourceCustomization = vlist;
+ }
+
+ public List<AllottedResourceCustomization> getServiceAllottedResources() {
+ return this.allottedResourceCustomization;
+ }
+
+ public void setServiceAllottedResources(List<AllottedResourceCustomization> v) {
+ this.allottedResourceCustomization = v;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (AllottedResourceCustomization o : allottedResourceCustomization) {
+ sb.append(i).append("\t");
+ if (!first)
+ sb.append("\n");
+
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
}
- @Override
- public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray)
- sb.append("{ ");
- if (isArray)
- sb.append("\"serviceAllottedResources\": [");
- Map<String, String> valueMap = new HashMap<>();
- String sep = "";
- boolean first = true;
-
- if (this.allottedResourceCustomization != null) {
- for (AllottedResourceCustomization o : allottedResourceCustomization) {
- if (first)
- sb.append("\n");
-
- first = false;
-
- boolean arNull = o.getAllottedResource() == null ? true : false;
-
- put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName());
- put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID());
- put(valueMap, "MODEL_INVARIANT_ID", arNull ? null : o.getAllottedResource().getModelInvariantUUID());
- put(valueMap, "MODEL_VERSION", arNull ? null : o.getAllottedResource().getModelVersion());
- put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName());
- put(valueMap, "TOSCA_NODE_TYPE", arNull ? null : o.getAllottedResource().getToscaNodeType());
- put(valueMap, "ALLOTTED_RESOURCE_TYPE", arNull ? null : o.getAllottedResource().getSubcategory());
- put(valueMap, "ALLOTTED_RESOURCE_ROLE", o.getTargetNetworkRole() != null ? o.getTargetNetworkRole() : o.getNfRole());
- put(valueMap, "NF_TYPE", o.getNfType());
- put(valueMap, "NF_ROLE", o.getNfRole());
- put(valueMap, "NF_FUNCTION", o.getNfFunction());
- put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
- put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUUID());
- put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUUID());
- put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName());
- put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
-
- sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
- sep = ",\n";
- }
- }
- if (!first)
- sb.append("\n");
-
- if (isArray)
- sb.append("]");
-
- if (!isEmbed && isArray)
- sb.append("}");
-
- return sb.toString();
- }
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceAllottedResources\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ if (this.allottedResourceCustomization != null) {
+ for (AllottedResourceCustomization o : allottedResourceCustomization) {
+ if (first)
+ sb.append("\n");
+
+ first = false;
+
+ boolean arNull = o.getAllottedResource() == null ? true : false;
+
+ put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName());
+ put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", arNull ? null : o.getAllottedResource().getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", arNull ? null : o.getAllottedResource().getModelVersion());
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+ put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName());
+ put(valueMap, "TOSCA_NODE_TYPE", arNull ? null : o.getAllottedResource().getToscaNodeType());
+ put(valueMap, "ALLOTTED_RESOURCE_TYPE", arNull ? null : o.getAllottedResource().getSubcategory());
+ put(valueMap, "ALLOTTED_RESOURCE_ROLE",
+ o.getTargetNetworkRole() != null ? o.getTargetNetworkRole() : o.getNfRole());
+ put(valueMap, "NF_TYPE", o.getNfType());
+ put(valueMap, "NF_ROLE", o.getNfRole());
+ put(valueMap, "NF_FUNCTION", o.getNfFunction());
+ put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
+ put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUUID());
+ put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUUID());
+ put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ }
+ if (!first)
+ sb.append("\n");
+
+ if (isArray)
+ sb.append("]");
+
+ if (!isEmbed && isArray)
+ sb.append("}");
+
+ return sb.toString();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
index 58a2e852f0..ee52abe047 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
@@ -21,7 +21,6 @@ package org.onap.so.adapters.catalogdb.catalogrest;
import java.util.HashMap;
import java.util.Map;
-
import org.apache.commons.lang3.StringUtils;
import org.onap.so.db.catalog.beans.Recipe;
import org.slf4j.Logger;
@@ -31,21 +30,20 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
/**
- * serivce csar query support
- * <br>
+ * serivce csar query support <br>
* <p>
* </p>
*
* @author
- * @version ONAP Beijing Release 2018-02-28
+ * @version ONAP Beijing Release 2018-02-28
*/
-public class QueryResourceRecipe extends CatalogQuery{
+public class QueryResourceRecipe extends CatalogQuery {
protected static Logger logger = LoggerFactory.getLogger(QueryResourceRecipe.class);
-
+
private Recipe resourceRecipe;
-
- public QueryResourceRecipe(Recipe resourceRecipe){
- this.resourceRecipe =resourceRecipe;
+
+ public QueryResourceRecipe(Recipe resourceRecipe) {
+ this.resourceRecipe = resourceRecipe;
}
@Override
@@ -56,25 +54,28 @@ public class QueryResourceRecipe extends CatalogQuery{
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- Map<String, String> valueMap = new HashMap<>();
- valueMap.put("id", null == resourceRecipe || null == resourceRecipe.getId()
- ? StringUtils.EMPTY :String.valueOf(resourceRecipe.getId()));
- valueMap.put("action", null == resourceRecipe || null == resourceRecipe.getAction()
- ? StringUtils.EMPTY :resourceRecipe.getAction());
- valueMap.put("orchestrationUri", null == resourceRecipe || null == resourceRecipe.getOrchestrationUri()
- ? StringUtils.EMPTY : resourceRecipe.getOrchestrationUri());
- valueMap.put("recipeTimeout", null == resourceRecipe || null == resourceRecipe.getRecipeTimeout()
- ? StringUtils.EMPTY : String.valueOf(resourceRecipe.getRecipeTimeout()));
- valueMap.put("paramXSD", null == resourceRecipe || null == resourceRecipe.getParamXsd()
- ? StringUtils.EMPTY : resourceRecipe.getParamXsd());
- valueMap.put("description", null == resourceRecipe || null == resourceRecipe.getDescription()
- ? StringUtils.EMPTY : resourceRecipe.getDescription());
+ Map<String, String> valueMap = new HashMap<>();
+ valueMap.put("id", null == resourceRecipe || null == resourceRecipe.getId() ? StringUtils.EMPTY
+ : String.valueOf(resourceRecipe.getId()));
+ valueMap.put("action", null == resourceRecipe || null == resourceRecipe.getAction() ? StringUtils.EMPTY
+ : resourceRecipe.getAction());
+ valueMap.put("orchestrationUri",
+ null == resourceRecipe || null == resourceRecipe.getOrchestrationUri() ? StringUtils.EMPTY
+ : resourceRecipe.getOrchestrationUri());
+ valueMap.put("recipeTimeout",
+ null == resourceRecipe || null == resourceRecipe.getRecipeTimeout() ? StringUtils.EMPTY
+ : String.valueOf(resourceRecipe.getRecipeTimeout()));
+ valueMap.put("paramXSD", null == resourceRecipe || null == resourceRecipe.getParamXsd() ? StringUtils.EMPTY
+ : resourceRecipe.getParamXsd());
+ valueMap.put("description",
+ null == resourceRecipe || null == resourceRecipe.getDescription() ? StringUtils.EMPTY
+ : resourceRecipe.getDescription());
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
String jsonStr = "";
try {
jsonStr = mapper.writeValueAsString(valueMap);
- } catch(JsonProcessingException e) {
+ } catch (JsonProcessingException e) {
logger.error("Error creating JSON", e);
}
return jsonStr;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java
index c7ae137759..1afd395136 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java
@@ -21,36 +21,29 @@ package org.onap.so.adapters.catalogdb.catalogrest;
import java.util.HashMap;
import java.util.Map;
-
import org.onap.so.db.catalog.beans.ToscaCsar;
/**
- * serivce csar query support
- * <br>
+ * serivce csar query support <br>
* <p>
* </p>
*
* @author
- * @version ONAP Beijing Release 2018-02-28
+ * @version ONAP Beijing Release 2018-02-28
*/
-public class QueryServiceCsar extends CatalogQuery{
-
- private static final String TEMPLATE =
- "\t{\n"+
- "\t\t\"artifactUUID\" : <ARTIFACT_UUID>,\n"+
- "\t\t\"name\" : <NAME>,\n"+
- "\t\t\"version\" : <VERSION>,\n"+
- "\t\t\"artifactChecksum\" : <ARTIFACT_CHECK_SUM>,\n"+
- "\t\t\"url\" : <URL>,\n"+
- "\t\t\"description\" : <DESCRIPTION>\n"+
- "\t}";
-
+public class QueryServiceCsar extends CatalogQuery {
+
+ private static final String TEMPLATE = "\t{\n" + "\t\t\"artifactUUID\" : <ARTIFACT_UUID>,\n"
+ + "\t\t\"name\" : <NAME>,\n" + "\t\t\"version\" : <VERSION>,\n"
+ + "\t\t\"artifactChecksum\" : <ARTIFACT_CHECK_SUM>,\n" + "\t\t\"url\" : <URL>,\n"
+ + "\t\t\"description\" : <DESCRIPTION>\n" + "\t}";
+
private ToscaCsar toscaCsar;
-
- public QueryServiceCsar(ToscaCsar toscaCsar){
+
+ public QueryServiceCsar(ToscaCsar toscaCsar) {
this.toscaCsar = toscaCsar;
}
-
+
@Override
public String toString() {
return toscaCsar.toString();
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index edbf9749c6..0eb7d0418e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -19,14 +19,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.adapters.catalogdb.catalogrest;
import java.util.HashMap;
import java.util.Map;
-
import javax.xml.bind.annotation.XmlRootElement;
-
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
@@ -34,68 +32,70 @@ import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
public class QueryServiceMacroHolder extends CatalogQuery {
private ServiceMacroHolder serviceMacroHolder;
private static final String LINE_BEGINNING = "(?m)^";
- private static final String TEMPLATE =
- "{ \"serviceResources\" : {\n"+
- "\t\"modelInfo\" : {\n"+
- "\t\t\"modelName\" : <SERVICE_MODEL_NAME>,\n"+
- "\t\t\"modelUuid\" : <SERVICE_MODEL_UUID>,\n"+
- "\t\t\"modelInvariantUuid\" : <SERVICE_MODEL_INVARIANT_ID>,\n"+
- "\t\t\"modelVersion\" : <SERVICE_MODEL_VERSION>\n"+
- "\t},\n"+
- "\t\"serviceType\" : <SERVICE_TYPE>,\n"+
- "\t\"serviceRole\" : <SERVICE_ROLE>,\n"+
- "\t\"environmentContext\" : <ENVIRONMENT_CONTEXT>,\n"+
- "\t\"resourceOrder\" : <RESOURCE_ORDER>,\n"+
- "\t\"workloadContext\" : <WORKLOAD_CONTEXT>,\n"+
- "<_SERVICEVNFS_>,\n"+
- "<_SERVICENETWORKS_>,\n"+
- "<_SERVICEALLOTTEDRESOURCES_>\n"+
- "\t}}";
-
- public QueryServiceMacroHolder() {
- super();
- serviceMacroHolder = new ServiceMacroHolder();
- }
- public QueryServiceMacroHolder(ServiceMacroHolder vlist) { serviceMacroHolder = vlist; }
-
- public ServiceMacroHolder getServiceResources(){ return this.serviceMacroHolder; }
- public void setServiceResources(ServiceMacroHolder v) { this.serviceMacroHolder = v; }
-
- @Override
- public String toString () { return serviceMacroHolder.toString(); }
-
- @Override
- public String JSON2(boolean isArray, boolean x) {
- Service service = serviceMacroHolder.getService();
- if (service == null) {
+ private static final String TEMPLATE = "{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : <SERVICE_MODEL_NAME>,\n"
+ + "\t\t\"modelUuid\" : <SERVICE_MODEL_UUID>,\n"
+ + "\t\t\"modelInvariantUuid\" : <SERVICE_MODEL_INVARIANT_ID>,\n"
+ + "\t\t\"modelVersion\" : <SERVICE_MODEL_VERSION>\n" + "\t},\n"
+ + "\t\"serviceType\" : <SERVICE_TYPE>,\n" + "\t\"serviceRole\" : <SERVICE_ROLE>,\n"
+ + "\t\"environmentContext\" : <ENVIRONMENT_CONTEXT>,\n" + "\t\"resourceOrder\" : <RESOURCE_ORDER>,\n"
+ + "\t\"workloadContext\" : <WORKLOAD_CONTEXT>,\n" + "<_SERVICEVNFS_>,\n" + "<_SERVICENETWORKS_>,\n"
+ + "<_SERVICEALLOTTEDRESOURCES_>\n" + "\t}}";
+
+ public QueryServiceMacroHolder() {
+ super();
+ serviceMacroHolder = new ServiceMacroHolder();
+ }
+
+ public QueryServiceMacroHolder(ServiceMacroHolder vlist) {
+ serviceMacroHolder = vlist;
+ }
+
+ public ServiceMacroHolder getServiceResources() {
+ return this.serviceMacroHolder;
+ }
+
+ public void setServiceResources(ServiceMacroHolder v) {
+ this.serviceMacroHolder = v;
+ }
+
+ @Override
+ public String toString() {
+ return serviceMacroHolder.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean x) {
+ Service service = serviceMacroHolder.getService();
+ if (service == null) {
return "\"serviceResources\": null";
- }
+ }
- StringBuilder buf = new StringBuilder();
- Map<String, String> valueMap = new HashMap<>();
+ StringBuilder buf = new StringBuilder();
+ Map<String, String> valueMap = new HashMap<>();
- put(valueMap, "SERVICE_MODEL_NAME", service.getModelName());
- put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID());
- put(valueMap, "SERVICE_MODEL_INVARIANT_ID", service.getModelInvariantUUID());
- put(valueMap, "SERVICE_MODEL_VERSION", service.getModelVersion());
- put(valueMap, "SERVICE_TYPE", service.getServiceType());
- put(valueMap, "SERVICE_ROLE", service.getServiceRole());
- put(valueMap, "ENVIRONMENT_CONTEXT", service.getEnvironmentContext());
- put(valueMap, "WORKLOAD_CONTEXT", service.getWorkloadContext());
- put(valueMap, "RESOURCE_ORDER", service.getResourceOrder());
+ put(valueMap, "SERVICE_MODEL_NAME", service.getModelName());
+ put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID());
+ put(valueMap, "SERVICE_MODEL_INVARIANT_ID", service.getModelInvariantUUID());
+ put(valueMap, "SERVICE_MODEL_VERSION", service.getModelVersion());
+ put(valueMap, "SERVICE_TYPE", service.getServiceType());
+ put(valueMap, "SERVICE_ROLE", service.getServiceRole());
+ put(valueMap, "ENVIRONMENT_CONTEXT", service.getEnvironmentContext());
+ put(valueMap, "WORKLOAD_CONTEXT", service.getWorkloadContext());
+ put(valueMap, "RESOURCE_ORDER", service.getResourceOrder());
- String subitem;
- subitem = new QueryServiceVnfs(service.getVnfCustomizations()).JSON2(true, true);
- valueMap.put("_SERVICEVNFS_", subitem.replaceAll(LINE_BEGINNING, "\t"));
+ String subitem;
+ subitem = new QueryServiceVnfs(service.getVnfCustomizations()).JSON2(true, true);
+ valueMap.put("_SERVICEVNFS_", subitem.replaceAll(LINE_BEGINNING, "\t"));
- subitem = new QueryServiceNetworks(service.getNetworkCustomizations()).JSON2(true, true);
- valueMap.put("_SERVICENETWORKS_", subitem.replaceAll(LINE_BEGINNING, "\t"));
+ subitem = new QueryServiceNetworks(service.getNetworkCustomizations()).JSON2(true, true);
+ valueMap.put("_SERVICENETWORKS_", subitem.replaceAll(LINE_BEGINNING, "\t"));
- subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true);
- valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t"));
+ subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true);
+ valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t"));
buf.append(this.setTemplate(TEMPLATE, valueMap));
- return buf.toString();
- }
+ return buf.toString();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index f7457fda4a..96ea797631 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -26,9 +26,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.xml.bind.annotation.XmlRootElement;
-
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,98 +34,99 @@ import org.slf4j.LoggerFactory;
@XmlRootElement(name = "serviceNetworks")
public class QueryServiceNetworks extends CatalogQuery {
protected static Logger logger = LoggerFactory.getLogger(QueryServiceNetworks.class);
- private List<NetworkResourceCustomization> serviceNetworks;
- private static final String TEMPLATE =
- "\t{\n"+
- "\t\t\"modelInfo\" : {\n"+
- "\t\t\t\"modelName\" : <MODEL_NAME>,\n"+
- "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+
- "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"+
- "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"+
- "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>,\n"+
- "\t\t\t\"modelInstanceName\" : <MODEL_INSTANCE_NAME>\n"+
- "\t},\n"+
- "\t\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"+
- "\t\t\"networkType\" : <NETWORK_TYPE>,\n"+
- "\t\t\"networkTechnology\" : <NETWORK_TECHNOLOGY>,\n"+
- "\t\t\"resourceInput\" : <RESOURCE_INPUT>,\n"+
- "\t\t\"networkRole\" : <NETWORK_ROLE>,\n"+
- "\t\t\"networkScope\" : <NETWORK_SCOPE>\n"+
- "\t}";
+ private List<NetworkResourceCustomization> serviceNetworks;
+ private static final String TEMPLATE =
+ "\t{\n" + "\t\t\"modelInfo\" : {\n" + "\t\t\t\"modelName\" : <MODEL_NAME>,\n"
+ + "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>,\n"
+ + "\t\t\t\"modelInstanceName\" : <MODEL_INSTANCE_NAME>\n" + "\t},\n"
+ + "\t\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"
+ + "\t\t\"networkType\" : <NETWORK_TYPE>,\n"
+ + "\t\t\"networkTechnology\" : <NETWORK_TECHNOLOGY>,\n"
+ + "\t\t\"resourceInput\" : <RESOURCE_INPUT>,\n"
+ + "\t\t\"networkRole\" : <NETWORK_ROLE>,\n"
+ + "\t\t\"networkScope\" : <NETWORK_SCOPE>\n" + "\t}";
- public QueryServiceNetworks() {
- super();
- serviceNetworks = new ArrayList<>();
- }
-
- public QueryServiceNetworks(List<NetworkResourceCustomization> vlist) {
- logger.debug ("QueryServiceNetworks:");
- serviceNetworks = new ArrayList<>();
- for (NetworkResourceCustomization o : vlist) {
- if(logger.isDebugEnabled())
- logger.debug (o.toString());
- serviceNetworks.add(o);
- }
- }
+ public QueryServiceNetworks() {
+ super();
+ serviceNetworks = new ArrayList<>();
+ }
- public List<NetworkResourceCustomization> getServiceNetworks(){ return this.serviceNetworks; }
- public void setServiceNetworks(List<NetworkResourceCustomization> v) { this.serviceNetworks = v; }
+ public QueryServiceNetworks(List<NetworkResourceCustomization> vlist) {
+ logger.debug("QueryServiceNetworks:");
+ serviceNetworks = new ArrayList<>();
+ for (NetworkResourceCustomization o : vlist) {
+ if (logger.isDebugEnabled())
+ logger.debug(o.toString());
+ serviceNetworks.add(o);
+ }
+ }
- @Override
- public String toString () {
- StringBuilder sb = new StringBuilder();
+ public List<NetworkResourceCustomization> getServiceNetworks() {
+ return this.serviceNetworks;
+ }
- boolean first = true;
- int i = 1;
- for (NetworkResourceCustomization o : serviceNetworks) {
- sb.append(i).append("\t");
- if (!first)
- sb.append("\n");
- first = false;
- sb.append(o);
- }
- return sb.toString();
+ public void setServiceNetworks(List<NetworkResourceCustomization> v) {
+ this.serviceNetworks = v;
}
- @Override
- public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray)
- sb.append("{ ");
- if (isArray)
- sb.append("\"serviceNetworks\": [");
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
- Map<String, String> valueMap = new HashMap<>();
- String sep = "";
- boolean first = true;
+ boolean first = true;
+ int i = 1;
+ for (NetworkResourceCustomization o : serviceNetworks) {
+ sb.append(i).append("\t");
+ if (!first)
+ sb.append("\n");
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceNetworks\": [");
- for (NetworkResourceCustomization o : serviceNetworks) {
- if (first)
- sb.append("\n");
- first = false;
- boolean nrNull = o.getNetworkResource() == null ? true : false;
- put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
- put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
- put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID());
- put(valueMap, "MODEL_VERSION", nrNull ? null : o.getNetworkResource().getModelVersion());
- put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName());
- put(valueMap, "TOSCA_NODE_TYPE", nrNull ? null : o.getNetworkResource().getToscaNodeType());
- put(valueMap, "NETWORK_TYPE", o.getNetworkType());
- put(valueMap, "NETWORK_ROLE", o.getNetworkRole());
- put(valueMap, "NETWORK_SCOPE", o.getNetworkScope());
- put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology());
- put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (NetworkResourceCustomization o : serviceNetworks) {
+ if (first)
+ sb.append("\n");
+ first = false;
+ boolean nrNull = o.getNetworkResource() == null ? true : false;
+ put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
+ put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", nrNull ? null : o.getNetworkResource().getModelVersion());
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+ put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName());
+ put(valueMap, "TOSCA_NODE_TYPE", nrNull ? null : o.getNetworkResource().getToscaNodeType());
+ put(valueMap, "NETWORK_TYPE", o.getNetworkType());
+ put(valueMap, "NETWORK_ROLE", o.getNetworkRole());
+ put(valueMap, "NETWORK_SCOPE", o.getNetworkScope());
+ put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
- }
- if (!first)
- sb.append("\n");
- if (isArray)
- sb.append("]");
- if (!isEmbed && isArray)
- sb.append("}");
- return sb.toString();
- }
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index 4170047e0b..b1bdeda445 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.adapters.catalogdb.catalogrest;
/* should be called QueryVnfResource.java */
@@ -25,9 +25,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.xml.bind.annotation.XmlRootElement;
-
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,105 +33,102 @@ import org.slf4j.LoggerFactory;
@XmlRootElement(name = "serviceVnfs")
public class QueryServiceVnfs extends CatalogQuery {
protected static Logger logger = LoggerFactory.getLogger(QueryServiceVnfs.class);
-
- private List<VnfResourceCustomization> serviceVnfs;
- private static final String TEMPLATE =
- "\n"+
- "\t{ \"modelInfo\" : {\n"+
- "\t\t\"modelName\" : <MODEL_NAME>,\n"+
- "\t\t\"modelUuid\" : <MODEL_UUID>,\n"+
- "\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"+
- "\t\t\"modelVersion\" : <MODEL_VERSION>,\n"+
- "\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>,\n"+
- "\t\t\"modelInstanceName\" : <MODEL_INSTANCE_NAME>\n"+
- "\t\t},\n"+
- "\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"+
- "\t\"nfFunction\" : <NF_FUNCTION>,\n"+
- "\t\"nfType\" : <NF_TYPE>,\n"+
- "\t\"nfRole\" : <NF_ROLE>,\n"+
- "\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"+
- "\t\"multiStageDesign\" : <MULTI_STEP_DESIGN>,\n"+
- "\t\"resourceInput\" : <RESOURCE_INPUT>,\n"+
- "<_VFMODULES_>\n" +
- "\t}";
-
- public QueryServiceVnfs() {
- super();
- serviceVnfs = new ArrayList<>();
- }
-
- public QueryServiceVnfs(List<VnfResourceCustomization> vlist) {
- serviceVnfs = new ArrayList<>();
- for (VnfResourceCustomization o : vlist) {
- if(logger.isDebugEnabled())
- logger.debug (o.toString());
- serviceVnfs.add(o);
- }
- }
-
- public List<VnfResourceCustomization> getServiceVnfs(){ return this.serviceVnfs; }
- public void setServiceVnfs(List<VnfResourceCustomization> v) { this.serviceVnfs = v; }
-
- @Override
- public String toString () {
- StringBuilder sb = new StringBuilder();
-
- boolean first = true;
- int i = 1;
- for (VnfResourceCustomization o : serviceVnfs) {
- sb.append(i).append("\t");
- if (!first)
- sb.append("\n");
- first = false;
- sb.append(o);
- }
- return sb.toString();
+
+ private List<VnfResourceCustomization> serviceVnfs;
+ private static final String TEMPLATE = "\n" + "\t{ \"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : <MODEL_NAME>,\n" + "\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>,\n"
+ + "\t\t\"modelInstanceName\" : <MODEL_INSTANCE_NAME>\n" + "\t\t},\n"
+ + "\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"
+ + "\t\"nfFunction\" : <NF_FUNCTION>,\n" + "\t\"nfType\" : <NF_TYPE>,\n"
+ + "\t\"nfRole\" : <NF_ROLE>,\n" + "\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"
+ + "\t\"multiStageDesign\" : <MULTI_STEP_DESIGN>,\n"
+ + "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>\n" + "\t}";
+
+ public QueryServiceVnfs() {
+ super();
+ serviceVnfs = new ArrayList<>();
}
- @Override
- public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray)
- sb.append("{ ");
- if (isArray)
- sb.append("\"serviceVnfs\": [");
- Map<String, String> valueMap = new HashMap<>();
- String sep = "";
- boolean first = true;
-
- for (VnfResourceCustomization o : serviceVnfs) {
- if (first)
- sb.append("\n");
- first = false;
-
- boolean vrNull = o.getVnfResources() == null ? true : false;
-
- put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName());
- put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID());
- put(valueMap, "MODEL_INVARIANT_ID", vrNull ? null : o.getVnfResources().getModelInvariantId());
- put(valueMap, "MODEL_VERSION", vrNull ? null : o.getVnfResources().getModelVersion());
- put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName());
- put(valueMap, "TOSCA_NODE_TYPE", vrNull ? null : o.getVnfResources().getToscaNodeType());
- put(valueMap, "NF_FUNCTION", o.getNfFunction());
- put(valueMap, "NF_TYPE", o.getNfType());
- put(valueMap, "NF_ROLE", o.getNfRole());
- put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
- put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
- put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
-
- String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
- valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
+ public QueryServiceVnfs(List<VnfResourceCustomization> vlist) {
+ serviceVnfs = new ArrayList<>();
+ for (VnfResourceCustomization o : vlist) {
+ if (logger.isDebugEnabled())
+ logger.debug(o.toString());
+ serviceVnfs.add(o);
+ }
+ }
+
+ public List<VnfResourceCustomization> getServiceVnfs() {
+ return this.serviceVnfs;
+ }
+
+ public void setServiceVnfs(List<VnfResourceCustomization> v) {
+ this.serviceVnfs = v;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (VnfResourceCustomization o : serviceVnfs) {
+ sb.append(i).append("\t");
+ if (!first)
+ sb.append("\n");
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceVnfs\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (VnfResourceCustomization o : serviceVnfs) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ boolean vrNull = o.getVnfResources() == null ? true : false;
+
+ put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName());
+ put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", vrNull ? null : o.getVnfResources().getModelInvariantId());
+ put(valueMap, "MODEL_VERSION", vrNull ? null : o.getVnfResources().getModelVersion());
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+ put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName());
+ put(valueMap, "TOSCA_NODE_TYPE", vrNull ? null : o.getVnfResources().getToscaNodeType());
+ put(valueMap, "NF_FUNCTION", o.getNfFunction());
+ put(valueMap, "NF_TYPE", o.getNfType());
+ put(valueMap, "NF_ROLE", o.getNfRole());
+ put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
+ put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+
+ String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
+ valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
- }
- if (!first)
- sb.append("\n");
- if (isArray)
- sb.append("]");
- if (!isEmbed && isArray)
- sb.append("}");
- return sb.toString();
- }
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
index 3680c59dca..1dec9cecae 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -17,114 +17,112 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.adapters.catalogdb.catalogrest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.xml.bind.annotation.XmlRootElement;
-
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
@XmlRootElement(name = "vfModules")
public class QueryVfModule extends CatalogQuery {
- private List<VfModuleCustomization> vfModules;
- private static final String TEMPLATE =
- "\t{\n"+
- "\t\t\"modelInfo\" : { \n"+
- "\t\t\t\"modelName\" : <MODEL_NAME>,\n"+
- "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+
- "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"+
- "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"+
- "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>\n"+
- "\t\t},"+
- "\t\t\"isBase\" : <IS_BASE>,\n"+
- "\t\t\"vfModuleLabel\" : <VF_MODULE_LABEL>,\n"+
- "\t\t\"initialCount\" : <INITIAL_COUNT>,\n"+
- "\t\t\"hasVolumeGroup\" : <HAS_VOLUME_GROUP>\n"+
- "\t}";
+ private List<VfModuleCustomization> vfModules;
+ private static final String TEMPLATE = "\t{\n" + "\t\t\"modelInfo\" : { \n"
+ + "\t\t\t\"modelName\" : <MODEL_NAME>,\n"
+ + "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>\n" + "\t\t},"
+ + "\t\t\"isBase\" : <IS_BASE>,\n" + "\t\t\"vfModuleLabel\" : <VF_MODULE_LABEL>,\n"
+ + "\t\t\"initialCount\" : <INITIAL_COUNT>,\n"
+ + "\t\t\"hasVolumeGroup\" : <HAS_VOLUME_GROUP>\n" + "\t}";
+
+ public QueryVfModule() {
+ super();
+ vfModules = new ArrayList<>();
+ }
- public QueryVfModule() {
- super();
- vfModules = new ArrayList<>();
- }
-
- public QueryVfModule(List<VfModuleCustomization> vlist) {
- vfModules = new ArrayList<>();
- if (vlist != null) {
- for (VfModuleCustomization o : vlist) {
- if(logger.isDebugEnabled())
- logger.debug (o.toString());
- vfModules.add(o);
- }
- }
- }
+ public QueryVfModule(List<VfModuleCustomization> vlist) {
+ vfModules = new ArrayList<>();
+ if (vlist != null) {
+ for (VfModuleCustomization o : vlist) {
+ if (logger.isDebugEnabled())
+ logger.debug(o.toString());
+ vfModules.add(o);
+ }
+ }
+ }
- public List<VfModuleCustomization> getVfModule(){ return this.vfModules; }
- public void setVfModule(List<VfModuleCustomization> v) { this.vfModules = v; }
+ public List<VfModuleCustomization> getVfModule() {
+ return this.vfModules;
+ }
- @Override
- public String toString () {
- StringBuilder sb = new StringBuilder();
+ public void setVfModule(List<VfModuleCustomization> v) {
+ this.vfModules = v;
+ }
- boolean first = true;
- int i = 1;
- for (VfModuleCustomization o : vfModules) {
- sb.append(i).append("\t");
- if (!first)
- sb.append("\n");
- first = false;
- sb.append(o);
- }
- return sb.toString();
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (VfModuleCustomization o : vfModules) {
+ sb.append(i).append("\t");
+ if (!first)
+ sb.append("\n");
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
}
- @Override
- public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuilder sb = new StringBuilder();
- if (!isEmbed && isArray)
- sb.append("{ ");
- if (isArray)
- sb.append("\"vfModules\": [");
- Map<String, String> valueMap = new HashMap<>();
- String sep = "";
- boolean first = true;
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"vfModules\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
- for (VfModuleCustomization o : vfModules) {
- if (first)
- sb.append("\n");
- first = false;
+ for (VfModuleCustomization o : vfModules) {
+ if (first)
+ sb.append("\n");
+ first = false;
- boolean vfNull = o.getVfModule() == null ? true : false;
- boolean hasVolumeGroup = false;
- HeatEnvironment envt = o.getVolumeHeatEnv();
- if (envt != null) {
- hasVolumeGroup = true;
- }
+ boolean vfNull = o.getVfModule() == null ? true : false;
+ boolean hasVolumeGroup = false;
+ HeatEnvironment envt = o.getVolumeHeatEnv();
+ if (envt != null) {
+ hasVolumeGroup = true;
+ }
- put(valueMap, "MODEL_NAME", vfNull ? null : o.getVfModule().getModelName());
- put(valueMap, "MODEL_UUID", vfNull ? null : o.getVfModule().getModelUUID());
- put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID());
- put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion());
- put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false);
- put(valueMap, "VF_MODULE_LABEL", o.getLabel());
- put(valueMap, "INITIAL_COUNT", o.getInitialCount());
- put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup));
+ put(valueMap, "MODEL_NAME", vfNull ? null : o.getVfModule().getModelName());
+ put(valueMap, "MODEL_UUID", vfNull ? null : o.getVfModule().getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion());
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+ put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false);
+ put(valueMap, "VF_MODULE_LABEL", o.getLabel());
+ put(valueMap, "INITIAL_COUNT", o.getInitialCount());
+ put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup));
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
- }
- if (!first)
- sb.append("\n");
- if (isArray)
- sb.append("]");
- if (!isEmbed && isArray)
- sb.append("}");
- return sb.toString();
- }
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 5009dce020..6cc53e6ec9 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -26,7 +26,6 @@ package org.onap.so.adapters.catalogdb.rest;
import java.util.ArrayList;
import java.util.List;
-
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -36,7 +35,6 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.apache.http.HttpStatus;
import org.onap.so.adapters.catalogdb.catalogrest.CatalogQuery;
import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryException;
@@ -125,176 +123,159 @@ public class CatalogDbAdapterRest {
private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
- return Response
- .status(respStatus)
- .entity(qryResp.toJsonString(version, isArray))
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
+ return Response.status(respStatus).entity(qryResp.toJsonString(version, isArray))
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
}
@GET
@Path("vnfResources/{vnfModelCustomizationUuid}")
- @Transactional( readOnly = true)
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response serviceVnfs (
- @PathParam("version") String version,
- @PathParam("vnfModelCustomizationUuid") String vnfUuid
- ) {
- return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null);
+ @Transactional(readOnly = true)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ public Response serviceVnfs(@PathParam("version") String version,
+ @PathParam("vnfModelCustomizationUuid") String vnfUuid) {
+ return serviceVnfsImpl(version, !IS_ARRAY, vnfUuid, null, null, null, null);
}
@GET
@Path("serviceVnfs")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceVnfs(
- @PathParam("version") String version,
- @QueryParam("vnfModelCustomizationUuid") String vnfUuid,
- @QueryParam("serviceModelUuid") String smUuid,
- @QueryParam("serviceModelInvariantUuid") String smiUuid,
- @QueryParam("serviceModelVersion") String smVer,
- @QueryParam("serviceModelName") String smName
- ) {
- return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName);
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response serviceVnfs(@PathParam("version") String version,
+ @QueryParam("vnfModelCustomizationUuid") String vnfUuid, @QueryParam("serviceModelUuid") String smUuid,
+ @QueryParam("serviceModelInvariantUuid") String smiUuid, @QueryParam("serviceModelVersion") String smVer,
+ @QueryParam("serviceModelName") String smName) {
+ return serviceVnfsImpl(version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName);
}
- public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) {
+ public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID,
+ String smiUuid, String smVer, String smName) {
QueryServiceVnfs qryResp = null;
- int respStatus = HttpStatus.SC_OK;
+ int respStatus = HttpStatus.SC_OK;
List<VnfResourceCustomization> ret = new ArrayList<>();
Service service = null;
try {
- if (vnfUuid != null && !"".equals(vnfUuid))
- ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid);
- else if (serviceModelUUID != null && !"".equals(serviceModelUUID))
+ if (vnfUuid != null && !"".equals(vnfUuid))
+ ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid);
+ else if (serviceModelUUID != null && !"".equals(serviceModelUUID))
service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID);
- else if (smiUuid != null && !"".equals(smiUuid))
- if (smVer != null && !"".equals(smVer))
- service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer,smiUuid);
- else
+ else if (smiUuid != null && !"".equals(smiUuid))
+ if (smVer != null && !"".equals(smVer))
+ service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer, smiUuid);
+ else
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid);
else if (smName != null && !"".equals(smName)) {
- if (smVer != null && !"".equals(smVer))
+ if (smVer != null && !"".equals(smVer))
service = serviceRepo.findByModelNameAndModelVersion(smName, smVer);
- else
- service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName);
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
+ else
+ service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName);
+ } else {
+ throw (new Exception(NO_MATCHING_PARAMETERS));
}
if (service == null && ret.isEmpty()) {
respStatus = HttpStatus.SC_NOT_FOUND;
qryResp = new QueryServiceVnfs();
- }else if( service == null && !ret.isEmpty()){
- qryResp = new QueryServiceVnfs(ret);
+ } else if (service == null && !ret.isEmpty()) {
+ qryResp = new QueryServiceVnfs(ret);
} else if (service != null) {
- qryResp = new QueryServiceVnfs(service.getVnfCustomizations());
+ qryResp = new QueryServiceVnfs(service.getVnfCustomizations());
}
- logger.debug ("serviceVnfs qryResp= {}", qryResp);
+ logger.debug("serviceVnfs qryResp= {}", qryResp);
return respond(version, respStatus, isArray, qryResp);
} catch (Exception e) {
logger.error("Exception - queryServiceVnfs", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
@GET
@Path("networkResources/{networkModelCustomizationUuid}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceNetworks (
- @PathParam("version") String version,
- @PathParam("networkModelCustomizationUuid") String nUuid
- ) {
- return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null);
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response serviceNetworks(@PathParam("version") String version,
+ @PathParam("networkModelCustomizationUuid") String nUuid) {
+ return serviceNetworksImpl(version, !IS_ARRAY, nUuid, null, null, null, null);
}
@GET
@Path("serviceNetworks")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceNetworks (
- @PathParam("version") String version,
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response serviceNetworks(@PathParam("version") String version,
@QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid,
- @QueryParam("networkType") String networkType,
- @QueryParam("networkModelName") String networkModelName,
+ @QueryParam("networkType") String networkType, @QueryParam("networkModelName") String networkModelName,
@QueryParam("serviceModelUuid") String serviceModelUuid,
@QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid,
@QueryParam("serviceModelVersion") String serviceModelVersion,
- @QueryParam("networkModelVersion") String networkModelVersion
- ) {
+ @QueryParam("networkModelVersion") String networkModelVersion) {
if (networkModelName != null && !"".equals(networkModelName)) {
networkType = networkModelName;
}
- return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion);
+ return serviceNetworksImpl(version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid,
+ serviceModelInvariantUuid, serviceModelVersion);
}
- public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) {
+ public Response serviceNetworksImpl(String version, boolean isArray, String networkModelCustomizationUuid,
+ String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) {
QueryServiceNetworks qryResp;
int respStatus = HttpStatus.SC_OK;
String uuid = "";
List<NetworkResourceCustomization> ret = new ArrayList<>();
Service service = null;
- try{
+ try {
if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) {
- uuid = networkModelCustomizationUuid;
+ uuid = networkModelCustomizationUuid;
ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid);
- }else if (networkType != null && !"".equals(networkType)) {
- uuid = networkType;
- NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
- if(networkResources != null)
- ret=networkResources.getNetworkResourceCustomization();
- }
- else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
+ } else if (networkType != null && !"".equals(networkType)) {
+ uuid = networkType;
+ NetworkResource networkResources =
+ networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
+ if (networkResources != null)
+ ret = networkResources.getNetworkResourceCustomization();
+ } else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
uuid = serviceModelInvariantUuid;
- if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
+ if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
- }
- else {
+ } else {
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
}
- }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) {
- uuid = serviceModelUuid;
+ } else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) {
+ uuid = serviceModelUuid;
service = serviceRepo.findOneByModelUUID(serviceModelUuid);
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
+ } else {
+ throw (new Exception(NO_MATCHING_PARAMETERS));
}
- if(service != null)
+ if (service != null)
ret = service.getNetworkCustomizations();
if (ret == null || ret.isEmpty()) {
- logger.debug ("serviceNetworks not found");
+ logger.debug("serviceNetworks not found");
respStatus = HttpStatus.SC_NOT_FOUND;
qryResp = new QueryServiceNetworks();
- } else {
+ } else {
qryResp = new QueryServiceNetworks(ret);
- logger.debug ("serviceNetworks found qryResp= {}", qryResp);
+ logger.debug("serviceNetworks found qryResp= {}", qryResp);
}
return respond(version, respStatus, isArray, qryResp);
} catch (Exception e) {
- logger.error ("Exception - queryServiceNetworks", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
+ logger.error("Exception - queryServiceNetworks", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
@GET
@Path("serviceResources")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Transactional(readOnly = true)
- public Response serviceResources(
- @PathParam("version") String version,
+ public Response serviceResources(@PathParam("version") String version,
@QueryParam("serviceModelUuid") String modelUUID,
@QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
@QueryParam("serviceModelVersion") String modelVersion) {
@@ -303,11 +284,11 @@ public class CatalogDbAdapterRest {
String uuid = "";
ServiceMacroHolder ret = new ServiceMacroHolder();
- try{
+ try {
if (modelUUID != null && !"".equals(modelUUID)) {
uuid = modelUUID;
- logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: {}" , uuid);
- Service serv =serviceRepo.findOneByModelUUID(uuid);
+ logger.debug("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: {}", uuid);
+ Service serv = serviceRepo.findOneByModelUUID(uuid);
if (serv != null) {
ret.setNetworkResourceCustomizations(new ArrayList(serv.getNetworkCustomizations()));
@@ -315,163 +296,149 @@ public class CatalogDbAdapterRest {
ret.setAllottedResourceCustomizations(new ArrayList(serv.getAllottedCustomizations()));
}
ret.setService(serv);
- }
- else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) {
+ } else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) {
uuid = modelInvariantUUID;
if (modelVersion != null && !"".equals(modelVersion)) {
- logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion);
+ logger.debug(
+ "Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",
+ uuid, modelVersion);
Service serv = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(modelVersion, uuid);
ret.setService(serv);
- }
- else {
- logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: {}" , uuid);
+ } else {
+ logger.debug(
+ "Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: {}",
+ uuid);
Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
ret.setService(serv);
}
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
+ } else {
+ throw (new Exception(NO_MATCHING_PARAMETERS));
}
if (ret.getService() == null) {
- logger.debug ("serviceMacroHolder not found");
+ logger.debug("serviceMacroHolder not found");
respStatus = HttpStatus.SC_NOT_FOUND;
qryResp = new QueryServiceMacroHolder();
} else {
qryResp = new QueryServiceMacroHolder(ret);
- logger.debug ("serviceMacroHolder qryResp= {}", qryResp);
+ logger.debug("serviceMacroHolder qryResp= {}", qryResp);
}
return respond(version, respStatus, IS_ARRAY, qryResp);
} catch (Exception e) {
- logger.error ("Exception - queryServiceMacroHolder", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp){} )
- .build();
+ logger.error("Exception - queryServiceMacroHolder", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
@GET
@Path("allottedResources/{arModelCustomizationUuid}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceAllottedResources (
- @PathParam("version") String version,
- @PathParam("arModelCustomizationUuid") String aUuid
- ) {
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response serviceAllottedResources(@PathParam("version") String version,
+ @PathParam("arModelCustomizationUuid") String aUuid) {
return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null);
}
@GET
@Path("serviceAllottedResources")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
- public Response serviceAllottedResources(
- @PathParam("version") String version,
- @QueryParam("serviceModelUuid") String smUuid,
- @QueryParam("serviceModelInvariantUuid") String smiUuid,
- @QueryParam("serviceModelVersion") String smVer,
- @QueryParam("arModelCustomizationUuid") String aUuid
- ) {
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response serviceAllottedResources(@PathParam("version") String version,
+ @QueryParam("serviceModelUuid") String smUuid, @QueryParam("serviceModelInvariantUuid") String smiUuid,
+ @QueryParam("serviceModelVersion") String smVer, @QueryParam("arModelCustomizationUuid") String aUuid) {
return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer);
}
- public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) {
+ public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid,
+ String serviceModelInvariantUuid, String smVer) {
QueryAllottedResourceCustomization qryResp;
int respStatus = HttpStatus.SC_OK;
String uuid = "";
List<AllottedResourceCustomization> ret = new ArrayList<>();
Service service = null;
- try{
+ try {
if (smUuid != null && !"".equals(smUuid)) {
- uuid = smUuid;
- service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid);
- }
- else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
+ uuid = smUuid;
+ service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid);
+ } else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
uuid = serviceModelInvariantUuid;
- if (smVer != null && !"".equals(smVer)) {
+ if (smVer != null && !"".equals(smVer)) {
service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer, uuid);
- }
- else {
+ } else {
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
}
- }
- else if (aUuid != null && !"".equals(aUuid)) {
- uuid = aUuid;
+ } else if (aUuid != null && !"".equals(aUuid)) {
+ uuid = aUuid;
ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid);
- }
- else {
- throw(new Exception(NO_MATCHING_PARAMETERS));
+ } else {
+ throw (new Exception(NO_MATCHING_PARAMETERS));
}
- if(service != null)
- ret=service.getAllottedCustomizations();
+ if (service != null)
+ ret = service.getAllottedCustomizations();
if (ret == null || ret.isEmpty()) {
- logger.debug ("AllottedResourceCustomization not found");
+ logger.debug("AllottedResourceCustomization not found");
respStatus = HttpStatus.SC_NOT_FOUND;
qryResp = new QueryAllottedResourceCustomization();
- } else {
+ } else {
qryResp = new QueryAllottedResourceCustomization(ret);
- logger.debug ("AllottedResourceCustomization qryResp= {}", qryResp);
- }
+ logger.debug("AllottedResourceCustomization qryResp= {}", qryResp);
+ }
return respond(version, respStatus, isArray, qryResp);
} catch (Exception e) {
- logger.error ("Exception - queryAllottedResourceCustomization", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
+ logger.error("Exception - queryAllottedResourceCustomization", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
@GET
@Path("vfModules")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Transactional( readOnly = true)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) {
QueryVfModule qryResp;
int respStatus = HttpStatus.SC_OK;
- List<VfModuleCustomization> ret = null;
- try{
- if(vfModuleModelName != null && !"".equals(vfModuleModelName)){
+ List<VfModuleCustomization> ret = null;
+ try {
+ if (vfModuleModelName != null && !"".equals(vfModuleModelName)) {
VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName);
- if(vfModule != null)
- ret = vfModule.getVfModuleCustomization();
- }else{
- throw(new Exception(NO_MATCHING_PARAMETERS));
+ if (vfModule != null)
+ ret = vfModule.getVfModuleCustomization();
+ } else {
+ throw (new Exception(NO_MATCHING_PARAMETERS));
}
- if(ret == null || ret.isEmpty()){
- logger.debug ("vfModules not found");
+ if (ret == null || ret.isEmpty()) {
+ logger.debug("vfModules not found");
respStatus = HttpStatus.SC_NOT_FOUND;
qryResp = new QueryVfModule();
- }else{
- qryResp = new QueryVfModule(ret);
- if(logger.isDebugEnabled())
- logger.debug ("vfModules tojsonstring is: {}", qryResp.JSON2(false, false));
- }
- return Response
- .status(respStatus)
- .entity(qryResp.JSON2(false, false))
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
- }catch(Exception e){
- logger.error ("Exception during query VfModules by vfModuleModuleName: ", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
+ } else {
+ qryResp = new QueryVfModule(ret);
+ if (logger.isDebugEnabled())
+ logger.debug("vfModules tojsonstring is: {}", qryResp.JSON2(false, false));
+ }
+ return Response.status(respStatus).entity(qryResp.JSON2(false, false))
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ } catch (Exception e) {
+ logger.error("Exception during query VfModules by vfModuleModuleName: ", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
+
/**
- * Get the tosca csar info from catalog
- * <br>
+ * Get the tosca csar info from catalog <br>
*
* @param smUuid service model uuid
* @return the tosca csar information of the serivce.
@@ -479,13 +446,13 @@ public class CatalogDbAdapterRest {
*/
@GET
@Path("serviceToscaCsar")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) {
int respStatus = HttpStatus.SC_OK;
String entity = "";
try {
if (smUuid != null && !"".equals(smUuid)) {
- logger.debug("Query Csar by service model uuid: {}",smUuid);
+ logger.debug("Query Csar by service model uuid: {}", smUuid);
Service service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(smUuid);
@@ -504,26 +471,19 @@ public class CatalogDbAdapterRest {
} else {
throw (new Exception("Incoming parameter is null or blank"));
}
- return Response
- .status(respStatus)
- .entity(entity)
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
+ return Response.status(respStatus).entity(entity)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
} catch (Exception e) {
logger.error("Exception during query csar by service model uuid: ", e);
CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {
- })
- .build();
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
/**
- * Get the resource recipe info from catalog
- * <br>
+ * Get the resource recipe info from catalog <br>
*
* @param rmUuid resource model uuid
* @return the recipe information of the resource.
@@ -531,19 +491,21 @@ public class CatalogDbAdapterRest {
*/
@GET
@Path("resourceRecipe")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid,
+ @QueryParam("action") String action) {
int respStatus = HttpStatus.SC_OK;
String entity = "";
try {
if (rmUuid != null && !"".equals(rmUuid)) {
logger.debug("Query recipe by resource model uuid: {}", rmUuid);
- //check vnf and network and ar, the resource could be any resource.
+ // check vnf and network and ar, the resource could be any resource.
Recipe recipe = null;
VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
if (vnf != null) {
- recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndActionAndVersionStr(vnf.getModelName(), action, vnf.getModelVersion());
+ recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndActionAndVersionStr(vnf.getModelName(), action,
+ vnf.getModelVersion());
// for network service fetch the default recipe
if (recipe == null && vnf.getSubCategory().equalsIgnoreCase(NETWORK_SERVICE)) {
@@ -555,8 +517,9 @@ public class CatalogDbAdapterRest {
if (null == recipe) {
NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
- if(nResource != null) {
- recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(), action, nResource.getModelVersion());
+ if (nResource != null) {
+ recipe = networkRecipeRepo.findFirstByModelNameAndActionAndVersionStr(nResource.getModelName(),
+ action, nResource.getModelVersion());
// for network fetch the default recipe
if (recipe == null) {
@@ -568,7 +531,8 @@ public class CatalogDbAdapterRest {
if (null == recipe) {
AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);
if (arResource != null) {
- recipe = arRecipeRepo.findByModelNameAndActionAndVersion(arResource.getModelName(), action, arResource.getModelVersion());
+ recipe = arRecipeRepo.findByModelNameAndActionAndVersion(arResource.getModelName(), action,
+ arResource.getModelVersion());
}
}
if (recipe != null) {
@@ -580,20 +544,14 @@ public class CatalogDbAdapterRest {
} else {
throw new Exception("Incoming parameter is null or blank");
}
- return Response
- .status(respStatus)
- .entity(entity)
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
+ return Response.status(respStatus).entity(entity)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
} catch (Exception e) {
logger.error("Exception during query recipe by resource model uuid: ", e);
CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {
- })
- .build();
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java
index 3c05f8164b..4ffa38dd96 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/AllTestsTestSuite.java
@@ -19,14 +19,14 @@
*/
package org.onap.so.adapters.catalogdb;
-import org.junit.runner.RunWith;
+import org.junit.runner.RunWith;
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
@RunWith(WildcardPatternSuite.class)
@SuiteClasses("**/*Test.class")
public class AllTestsTestSuite {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // the class remains empty,
+ // used only as a holder for the above annotations
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
index b2a20681d9..3fb156d68a 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
@@ -12,10 +12,10 @@ import org.springframework.test.context.junit4.SpringRunner;
@ActiveProfiles("test")
public class CatalogDbAdapterBaseTest {
- @LocalServerPort
- protected int port;
-
-
- @Test
- public void testNothing(){}
+ @LocalServerPort
+ protected int port;
+
+
+ @Test
+ public void testNothing() {}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java
index 5d9eedb20f..eaf1bb3e4b 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java
@@ -19,6 +19,7 @@
*/
package org.onap.so.adapters.catalogdb;
+
import ch.vorburger.exec.ManagedProcessException;
import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
@@ -30,7 +31,7 @@ import org.springframework.context.annotation.Profile;
import javax.sql.DataSource;
@Configuration
-@Profile({"test","local"})
+@Profile({"test", "local"})
public class EmbeddedMariaDbConfig {
@Bean
@@ -40,21 +41,16 @@ public class EmbeddedMariaDbConfig {
@Bean
DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
- @Value("${mariaDB4j.databaseName}") String databaseName,
- @Value("${spring.datasource.username}") String datasourceUsername,
- @Value("${spring.datasource.password}") String datasourcePassword,
- @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
- //Create our database with default root user and no password
+ @Value("${mariaDB4j.databaseName}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ // Create our database with default root user and no password
mariaDB4jSpringService.getDB().createDB(databaseName);
DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
- return DataSourceBuilder
- .create()
- .username(datasourceUsername)
- .password(datasourcePassword)
- .url(config.getURL(databaseName))
- .driverClassName(datasourceDriver)
- .build();
+ return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword)
+ .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build();
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index bd8c5bc3e3..145ba50583 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -29,13 +29,10 @@ import static org.onap.so.logger.MdcConstants.RESPONSECODE;
import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
import static org.onap.so.logger.MdcConstants.STATUSCODE;
-
import java.io.IOException;
import java.util.Map;
-
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.json.JSONException;
import org.junit.Test;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
@@ -48,799 +45,801 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
-
import ch.qos.logback.classic.spi.ILoggingEvent;
public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
- private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules";
+ private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES =
+ "ecomp/mso/catalog/v2/serviceAllottedResources";
+
+ private static final String ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE = "ecomp/mso/catalog/v2/resourceRecipe";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS = "ecomp/mso/catalog/v2/serviceNetworks";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_VNFS = "ecomp/mso/catalog/v2/serviceVnfs";
+
+ private static final String ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES = "ecomp/mso/catalog/v2/serviceResources";
+
+ TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+
+ HttpHeaders headers = new HttpHeaders();
- private static final String ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES = "ecomp/mso/catalog/v2/serviceAllottedResources";
+ private final String expectedServiceResourceResponse =
+ "{\r\n\"serviceResources\": {\r\n\"modelInfo\": {\r\n\"modelName\": \"MSOTADevInfra_vSAMP10a_Service\",\r\n\"modelUuid\": \"5df8b6de-2083-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\"\r\n},\r\n\"serviceType\": \"NA\",\r\n\"serviceRole\": \"NA\",\r\n\"environmentContext\": \"Luna\",\r\n\"workloadContext\": \"Oxygen\",\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n],\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n],\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}\r\n}";
- private static final String ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE = "ecomp/mso/catalog/v2/resourceRecipe";
+ private final String expectedServiceResourceResponsev2 =
+ "{\r\n\"serviceResources\": {\r\n\"modelInfo\": {\r\n\"modelName\": \"MSOTADevInfra_vSAMP10a_Service\",\r\n\"modelUuid\": \"5df8b6de-2083-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\"\r\n},\r\n\"serviceType\": \"NA\",\r\n\"serviceRole\": \"NA\",\r\n\"environmentContext\": \"Luna\",\r\n\"workloadContext\": \"Oxygen\",\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002672\",\r\n\"modelInstanceName\": \"vSAMP10a 2\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n],\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n],\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}\r\n}";
- private static final String ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS = "ecomp/mso/catalog/v2/serviceNetworks";
- private static final String ECOMP_MSO_CATALOG_V2_SERVICE_VNFS = "ecomp/mso/catalog/v2/serviceVnfs";
+ private final String expectedServiceVnfResponse =
+ "{\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n]\r\n}";
- private static final String ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES = "ecomp/mso/catalog/v2/serviceResources";
+ private final String expectedServiceVnfResponseV3 =
+ "{\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002672\",\r\n\"modelInstanceName\": \"vSAMP10a 2\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n]\r\n}";
- TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+ private final String expectedServiceNetworkResourceResponse =
+ "{\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n]\r\n}";
- HttpHeaders headers = new HttpHeaders();
-
- private final String expectedServiceResourceResponse = "{\r\n\"serviceResources\": {\r\n\"modelInfo\": {\r\n\"modelName\": \"MSOTADevInfra_vSAMP10a_Service\",\r\n\"modelUuid\": \"5df8b6de-2083-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\"\r\n},\r\n\"serviceType\": \"NA\",\r\n\"serviceRole\": \"NA\",\r\n\"environmentContext\": \"Luna\",\r\n\"workloadContext\": \"Oxygen\",\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n],\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n],\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}\r\n}";
+ private final String badQueryParamResponse =
+ "{\"messageId\":null,\"message\":\"no matching parameters\",\"category\":\"INTERNAL\",\"rolledBack\":false}\"";
- private final String expectedServiceResourceResponsev2 = "{\r\n\"serviceResources\": {\r\n\"modelInfo\": {\r\n\"modelName\": \"MSOTADevInfra_vSAMP10a_Service\",\r\n\"modelUuid\": \"5df8b6de-2083-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\"\r\n},\r\n\"serviceType\": \"NA\",\r\n\"serviceRole\": \"NA\",\r\n\"environmentContext\": \"Luna\",\r\n\"workloadContext\": \"Oxygen\",\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002672\",\r\n\"modelInstanceName\": \"vSAMP10a 2\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n],\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n],\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}\r\n}";
+ private final String expectedAllottedResponse =
+ "{\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}";
-
- private final String expectedServiceVnfResponse = "{\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n]\r\n}";
+ private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671";
- private final String expectedServiceVnfResponseV3 = "{\r\n\"serviceVnfs\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002672\",\r\n\"modelInstanceName\": \"vSAMP10a 2\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002672\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002672\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}\r\n]\r\n}";
-
- private final String expectedServiceNetworkResourceResponse = "{\r\n\"serviceNetworks\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}\r\n]\r\n}";
-
- private final String badQueryParamResponse = "{\"messageId\":null,\"message\":\"no matching parameters\",\"category\":\"INTERNAL\",\"rolledBack\":false}\"";
-
- private final String expectedAllottedResponse = "{\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}";
-
- private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private final String arResourceUUID = "25e2d69b-3b22-47b8-b4c9-7b14fd4a80df";
- private final String arResourceUUID = "25e2d69b-3b22-47b8-b4c9-7b14fd4a80df";
-
- private final String serviceInvariantUUID = "9647dfc4-2083-11e7-93ae-92361f002671";
-
- /* Health Check Resources Endpoint */
-
- @Test
- public void testHealthcheck() throws JSONException {
+ private final String serviceInvariantUUID = "9647dfc4-2083-11e7-93ae-92361f002671";
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ /* Health Check Resources Endpoint */
- ResponseEntity<String> response = restTemplate.exchange(
- createURLWithPort("/manage/health"),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- for(ILoggingEvent logEvent : TestAppender.events)
- if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") &&
- logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")
- ){
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ @Test
+ public void testHealthcheck() throws JSONException {
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(createURLWithPort("/manage/health"), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ for (ILoggingEvent logEvent : TestAppender.events)
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor")
+ && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
+ Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- }else if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") &&
- logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("/manage/health", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor")
+ && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
+ Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("200",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
+ assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("/manage/health", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
}
- }
-
- /* Service Resources Endpoint */
-
- @Test
- public void testGetServiceModelUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
- .queryParam("serviceModelUuid", serviceUUID);
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceResourceResponse, response.getBody().toString(), JSONCompareMode.LENIENT);
- }
-
- @Test
- public void testGetServiceInvariantUUIDAndVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
- .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671").queryParam("serviceModelVersion", "1.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceResourceResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceInvariantUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
- .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceResourceResponsev2, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceInvariantUUIDEmtpyModelVer() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
- .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671").queryParam("serviceModelVersion", "");;
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceResourceResponsev2, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceModelUUID404() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- String expectedResponse = "\"serviceResources\": null";
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
- .queryParam("serviceModelUuid", "5df8b6de-2083-11e7-93");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceBadQueryParams() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
- .queryParam("BadQueryParam", "5df8b6de-2083-11e7-93");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
- }
-
- /* VNF Resources Endpoint */
-
- @Test
- public void testGetVNFResourcesByCustomizationUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}";
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/vnfResources/68dc9a92-214c-11e7-93ae-92361f002671"))
- ;
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
- }
-
-
-
- @Test
- public void testGetVNFResources404() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/vnfResources/68dc-11e7-93ae-92361f002671"))
- ;
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
-
- }
-
- @Test
- public void testGetServiceVNFResourcesByCustomizationUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("vnfModelCustomizationUuid", "68dc9a92-214c-11e7-93ae-92361f002671");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceVNFResourcesByServiceModelUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelUuid", serviceUUID);
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceVNFResourcesByServiceModelInvariantUUIDAndVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
- .queryParam("serviceModelVersion", "1.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceVNFResourcesByServiceModelInvariantUUIDEmptyVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
- .queryParam("serviceModelVersion", "");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
- }
-
-
- @Test
- public void testGetServiceVNFResourcesByServiceModelInvariantUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceVNFResourcesByServiceModelName() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceVNFResourcesByServiceModelNameEmptyVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service").queryParam("serviceModelVersion", "");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceVNFResourcesByServiceModelNameAndVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service").queryParam("serviceModelVersion", "1.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testSerfviceVNFResources404() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("serviceModelName", "BADNAME").queryParam("serviceModelVersion", "1.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
-
- }
-
-
- @Test
- public void testSerfviceVNFBadParams() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
- .queryParam("BadParamName", "BADNAME");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
-
-
- }
-
-
-
+ }
+
+ /* Service Resources Endpoint */
+
+ @Test
+ public void testGetServiceModelUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelUuid", serviceUUID);
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponse, response.getBody().toString(),
+ JSONCompareMode.LENIENT);
+ }
+
+ @Test
+ public void testGetServiceInvariantUUIDAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
+ .queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceInvariantUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponsev2, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceInvariantUUIDEmtpyModelVer() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
+ .queryParam("serviceModelVersion", "");;
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceResourceResponsev2, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceModelUUID404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse = "\"serviceResources\": null";
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("serviceModelUuid", "5df8b6de-2083-11e7-93");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceBadQueryParams() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES))
+ .queryParam("BadQueryParam", "5df8b6de-2083-11e7-93");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+ }
+
+ /* VNF Resources Endpoint */
+
+ @Test
+ public void testGetVNFResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse =
+ "{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10a\",\r\n\"modelUuid\": \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\"modelInstanceName\": \"vSAMP10a 1\"\r\n},\r\n\"toscaNodeType\": \"VF\",\r\n\"nfFunction\": \"vSAMP\",\r\n\"nfType\": \"vSAMP\",\r\n\"nfRole\": \"vSAMP\",\r\n\"nfNamingCode\": \"vSAMP\",\r\n\"multiStageDesign\": null,\r\n\"vfModules\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n},\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::PCM::module-1\",\r\n\"modelUuid\": \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": false,\r\n\"vfModuleLabel\": \"PCM\",\r\n\"initialCount\": 0,\r\n\"hasVolumeGroup\": false\r\n}\r\n]\r\n}";
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(
+ createURLWithPort("ecomp/mso/catalog/v2/vnfResources/68dc9a92-214c-11e7-93ae-92361f002671"));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+
+
+ @Test
+ public void testGetVNFResources404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/vnfResources/68dc-11e7-93ae-92361f002671"));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("vnfModelCustomizationUuid", "68dc9a92-214c-11e7-93ae-92361f002671");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelUuid", serviceUUID);
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelInvariantUUIDAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
+ .queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelInvariantUUIDEmptyVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671")
+ .queryParam("serviceModelVersion", "");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelInvariantUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelInvariantUuid", "9647dfc4-2083-11e7-93ae-92361f002671");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelName() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelNameEmptyVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service").queryParam("serviceModelVersion", "");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponseV3, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceVNFResourcesByServiceModelNameAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "MSOTADevInfra_vSAMP10a_Service")
+ .queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceVnfResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testSerfviceVNFResources404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("serviceModelName", "BADNAME").queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+
+ @Test
+ public void testSerfviceVNFBadParams() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_VNFS))
+ .queryParam("BadParamName", "BADNAME");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+
+
+ }
+
+
+
/* Network Resources Endpoint */
-
- @Test
- public void testGetNetworkResourcesByCustomizationUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}";
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/networkResources/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
- ;
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
- }
-
-
-
- @Test
- public void testGetNetworkResources404() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/networkResources/3bdbb104-4asdf"))
- ;
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
-
- }
-
- /* Service Network Resources Endpoints */
-
- @Test
- public void testGetServiceNetworkResourcesByUnknownQueryParam() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("serviceModelName", "PROVIDER NETWORK").queryParam("serviceModelVersion", "2.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceNetworkResourcesByServiceModelUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("serviceModelUuid", serviceUUID);
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceNetworkResourcesByServiceModelUUIDNotExist() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("serviceModelUuid", "doesNotExist");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
-
- }
-
- @Test
- public void testGetServiceNetworkResourcesByNetworkCustomizationUUIDNotExist() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("networkModelCustomizationUuid", "06b8966e-097c-4d63-afda-e0d");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
-
- }
-
- @Test
- public void testGetServiceNetworkResourcesByServiceModelInvariantUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("serviceModelInvariantUuid", serviceInvariantUUID);
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceNetworkResourcesByServiceModelInvariantUUIDAndVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
- .queryParam("serviceModelVersion", "2.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceNetworkResourcesByServiceModelInvariantAndEmptyVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
- .queryParam("serviceModelVersion", "");
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
- }
-
-
- @Test
- public void testGetServiceNetworkResourcesByNetworkCustomizationUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("networkModelCustomizationUuid", "3bdbb104-476c-483e-9f8b-c095b3d308ac");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceNetworkResourcesByNetworkModelName() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
- .queryParam("networkModelName", "CONTRAIL30_GNDIRECT");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
- }
-
- /* Allotted endpoints */
-
- @Test
- public void testGetAllottedResourcesByCustomizationUUID() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}";
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/allottedResources/367a8ba9-057a-4506-b106-fbae818597c6"));
-
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
- }
-
-
- @Test
- public void testGetAllottedResourcesByServiceModelUuuid() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
- .queryParam("serviceModelUuid",serviceUUID);
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testResourceReceipe() throws JSONException {
- String expectedResourceRecipe = "{\"orchestrationUri\":\"/mso/async/services/CreateSDNCNetworkResource\",\"action\":\"createInstance\",\"description\":\"sotnvpnattachmentvF\",\"id\":\"1\",\"recipeTimeout\":\"180\",\"paramXSD\":\"\"}";
-
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE))
- .queryParam("resourceModelUuid", arResourceUUID)
- .queryParam("action", "createInstance");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedResourceRecipe, response.getBody().toString(), false);
- }
-
- @Test
- public void testResourceReceipeNotMatched() throws JSONException {
-
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE))
- .queryParam("resourceModelUuid", arResourceUUID)
- .queryParam("action", "invalid_action");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
- }
-
- @Test
- public void testGetServiceAllottedResourcesByServiceModelInvariantUuid() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
- .queryParam("serviceModelInvariantUuid", serviceInvariantUUID);
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceAllottedResourcesByServiceModelInvariantUuidModelVersion() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
- .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
- .queryParam("serviceModelVersion", "1.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetServiceAllottedResourcesByServiceModelInvariantUuidModelVersionEmpty() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
- .queryParam("serviceModelInvariantUuid", serviceInvariantUUID)
- .queryParam("serviceModelVersion", "1.0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
- }
-
- @Test
- public void testGetAllottedResourcesByAllottedCustomizationId() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
- .queryParam("arModelCustomizationUuid", "367a8ba9-057a-4506-b106-fbae818597c6");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
- }
-
-
- @Test
- public void testGetAllottedResourcesResourcesNonExistResource() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
- .queryParam("arModelCustomizationUuid", "NOTEXIST");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
-
- }
-
- /* VF Modules Endpoint */
-
- @Test
- public void testGetVFModulesNonExistResource() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
- .queryParam("vfModuleModelName", "NEUTRON_BASIC");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value());
-
- }
-
- @Test
- public void testGetVFModulesByVfModuleModelName() throws JSONException {
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
- String expectedResponse = "{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n}";
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
- .queryParam("vfModuleModelName", "vSAMP10aDEV::base::module-0");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
-
- }
-
- @Test
- public void testGetVFModulesBadQueryParam() throws JSONException, IOException {
- TestAppender.events.clear();
- HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- headers.set("Accept", MediaType.APPLICATION_JSON);
-
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
- .queryParam("ADASD", "NEUTRON_BASIC");
-
- ResponseEntity<String> response = restTemplate.exchange(
- builder.toUriString(),
- HttpMethod.GET, entity, String.class);
-
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value());
- JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
-
-
- for(ILoggingEvent logEvent : TestAppender.events)
- if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
- logEvent.getMarker().getName().equals("ENTRY")
- ){
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
- assertEquals("v2/vfModules",mdc.get(SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(STATUSCODE));
- }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
- logEvent.getMarker().getName().equals("EXIT")){
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
+
+ @Test
+ public void testGetNetworkResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse =
+ "{\r\n\"modelInfo\": {\r\n\"modelName\": \"CONTRAIL30_GNDIRECT\",\r\n\"modelUuid\": \"10b36f65-f4e6-4be6-ae49-9596dc1c47fc\",\r\n\"modelInvariantUuid\": \"ce4ff476-9641-4e60-b4d5-b4abbec1271d\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"3bdbb104-476c-483e-9f8b-c095b3d308ac\",\r\n\"modelInstanceName\": \"CONTRAIL30_GNDIRECT 9\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"networkType\": \"\",\r\n\"networkTechnology\": \"\",\r\n\"networkRole\": \"\",\r\n\"networkScope\": \"\"\r\n}";
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(
+ createURLWithPort("ecomp/mso/catalog/v2/networkResources/3bdbb104-476c-483e-9f8b-c095b3d308ac"));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+
+
+ @Test
+ public void testGetNetworkResources404() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort("ecomp/mso/catalog/v2/networkResources/3bdbb104-4asdf"));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ /* Service Network Resources Endpoints */
+
+ @Test
+ public void testGetServiceNetworkResourcesByUnknownQueryParam() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelName", "PROVIDER NETWORK").queryParam("serviceModelVersion", "2.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelUuid", serviceUUID);
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelUUIDNotExist() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelUuid", "doesNotExist");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByNetworkCustomizationUUIDNotExist() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("networkModelCustomizationUuid", "06b8966e-097c-4d63-afda-e0d");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelInvariantUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID);
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelInvariantUUIDAndVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID).queryParam("serviceModelVersion", "2.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByServiceModelInvariantAndEmptyVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID).queryParam("serviceModelVersion", "");
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetServiceNetworkResourcesByNetworkCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("networkModelCustomizationUuid", "3bdbb104-476c-483e-9f8b-c095b3d308ac");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceNetworkResourcesByNetworkModelName() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS))
+ .queryParam("networkModelName", "CONTRAIL30_GNDIRECT");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedServiceNetworkResourceResponse, response.getBody().toString(), false);
+ }
+
+ /* Allotted endpoints */
+
+ @Test
+ public void testGetAllottedResourcesByCustomizationUUID() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse =
+ "{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}";
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(
+ createURLWithPort("ecomp/mso/catalog/v2/allottedResources/367a8ba9-057a-4506-b106-fbae818597c6"));
+
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetAllottedResourcesByServiceModelUuuid() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelUuid", serviceUUID);
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testResourceReceipe() throws JSONException {
+ String expectedResourceRecipe =
+ "{\"orchestrationUri\":\"/mso/async/services/CreateSDNCNetworkResource\",\"action\":\"createInstance\",\"description\":\"sotnvpnattachmentvF\",\"id\":\"1\",\"recipeTimeout\":\"180\",\"paramXSD\":\"\"}";
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE))
+ .queryParam("resourceModelUuid", arResourceUUID).queryParam("action", "createInstance");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResourceRecipe, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testResourceReceipeNotMatched() throws JSONException {
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE))
+ .queryParam("resourceModelUuid", arResourceUUID).queryParam("action", "invalid_action");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
+ public void testGetServiceAllottedResourcesByServiceModelInvariantUuid() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID);
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceAllottedResourcesByServiceModelInvariantUuidModelVersion() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID).queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetServiceAllottedResourcesByServiceModelInvariantUuidModelVersionEmpty() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("serviceModelInvariantUuid", serviceInvariantUUID).queryParam("serviceModelVersion", "1.0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+ @Test
+ public void testGetAllottedResourcesByAllottedCustomizationId() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("arModelCustomizationUuid", "367a8ba9-057a-4506-b106-fbae818597c6");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false);
+ }
+
+
+ @Test
+ public void testGetAllottedResourcesResourcesNonExistResource() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES))
+ .queryParam("arModelCustomizationUuid", "NOTEXIST");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ /* VF Modules Endpoint */
+
+ @Test
+ public void testGetVFModulesNonExistResource() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
+ .queryParam("vfModuleModelName", "NEUTRON_BASIC");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ }
+
+ @Test
+ public void testGetVFModulesByVfModuleModelName() throws JSONException {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ String expectedResponse =
+ "{\r\n\"modelInfo\": {\r\n\"modelName\": \"vSAMP10aDEV::base::module-0\",\r\n\"modelUuid\": \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\"modelInvariantUuid\": \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\"modelVersion\": \"2\",\r\n\"modelCustomizationUuid\": \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n},\r\n\"isBase\": true,\r\n\"vfModuleLabel\": \"base\",\r\n\"initialCount\": 1,\r\n\"hasVolumeGroup\": false\r\n}";
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES))
+ .queryParam("vfModuleModelName", "vSAMP10aDEV::base::module-0");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(expectedResponse, response.getBody().toString(), false);
+
+ }
+
+ @Test
+ public void testGetVFModulesBadQueryParam() throws JSONException, IOException {
+ TestAppender.events.clear();
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES)).queryParam("ADASD", "NEUTRON_BASIC");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false);
+
+
+ for (ILoggingEvent logEvent : TestAppender.events)
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ && logEvent.getMarker().getName().equals("ENTRY")) {
+ Map<String, String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("v2/vfModules", mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS", mdc.get(STATUSCODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ && logEvent.getMarker().getName().equals("EXIT")) {
+ Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("500",mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
- assertEquals("v2/vfModules",mdc.get(SERVICE_NAME));
- assertEquals("ERROR",mdc.get(STATUSCODE));
+ assertEquals("500", mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("v2/vfModules", mdc.get(SERVICE_NAME));
+ assertEquals("ERROR", mdc.get(STATUSCODE));
assertNotNull(mdc.get(RESPONSEDESC));
- }
- }
-
- private String createURLWithPort(String uri) {
- return "http://localhost:" + port + uri;
- }
+ }
+ }
+
+ private String createURLWithPort(String uri) {
+ return "http://localhost:" + port + uri;
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java
index 3e30dcc3b2..15e986505e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java
@@ -26,12 +26,13 @@ import static org.junit.Assert.assertEquals;
public class CatalogQueryExceptionTest {
@Test
- public void catalogQueryExceptionConstructor(){
+ public void catalogQueryExceptionConstructor() {
CatalogQueryException messageCatalogQueryException = new CatalogQueryException("TestMessage");
assertNotNull(messageCatalogQueryException.getMessage());
- assertEquals("TestMessage",messageCatalogQueryException.getMessage());
+ assertEquals("TestMessage", messageCatalogQueryException.getMessage());
- CatalogQueryException paramsCatalogQueryException = new CatalogQueryException("TestMessage",CatalogQueryExceptionCategory.INTERNAL,true,"messageID");
+ CatalogQueryException paramsCatalogQueryException =
+ new CatalogQueryException("TestMessage", CatalogQueryExceptionCategory.INTERNAL, true, "messageID");
assertParams(paramsCatalogQueryException);
CatalogQueryException defaultCatalogQueryException = new CatalogQueryException();
@@ -44,12 +45,12 @@ public class CatalogQueryExceptionTest {
private void assertParams(CatalogQueryException paramsCatalogQueryException) {
assertNotNull(paramsCatalogQueryException.getMessage());
- assertEquals("TestMessage",paramsCatalogQueryException.getMessage());
+ assertEquals("TestMessage", paramsCatalogQueryException.getMessage());
assertNotNull(paramsCatalogQueryException.getCategory());
- assertEquals(CatalogQueryExceptionCategory.INTERNAL,paramsCatalogQueryException.getCategory());
+ assertEquals(CatalogQueryExceptionCategory.INTERNAL, paramsCatalogQueryException.getCategory());
assertNotNull(paramsCatalogQueryException.getRolledBack());
- assertEquals(true,paramsCatalogQueryException.getRolledBack());
+ assertEquals(true, paramsCatalogQueryException.getRolledBack());
assertNotNull(paramsCatalogQueryException.getMessageId());
- assertEquals("messageID",paramsCatalogQueryException.getMessageId());
+ assertEquals("messageID", paramsCatalogQueryException.getMessageId());
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
index f2f06d7f3d..bf5a742661 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
@@ -58,7 +58,7 @@ public class CloudConfigTest extends CatalogDbAdapterBaseTest {
@Transactional
public void createCloudSiteRest_TEST() {
headers.set("Accept", MediaType.APPLICATION_JSON);
- headers.set("Content-Type",MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
CloudSite cloudSite = new CloudSite();
cloudSite.setId("MTN7");
@@ -78,17 +78,19 @@ public class CloudConfigTest extends CatalogDbAdapterBaseTest {
cloudIdentity.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY);
cloudSite.setIdentityService(cloudIdentity);
String uri = "/cloudSite";
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:"+ port + uri);
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + port + uri);
HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers);
- ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(),
- HttpMethod.POST, request, String.class);
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.POST, request, String.class);
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value());
- builder = UriComponentsBuilder.fromHttpUrl("http://localhost:"+ port + uri +"/" + cloudSite.getId());
+ builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + port + uri + "/" + cloudSite.getId());
HttpEntity<String> entity = new HttpEntity<String>(null, headers);
- ResponseEntity<CloudSite> actualCloudSite = restTemplate.exchange(builder.toUriString(),HttpMethod.GET, entity, CloudSite.class);
- builder = UriComponentsBuilder.fromHttpUrl("http://localhost:"+ port + uri);
- ResponseEntity<String> cloudSiteString = restTemplate.exchange(builder.toUriString(),HttpMethod.GET, entity, String.class);
+ ResponseEntity<CloudSite> actualCloudSite =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, CloudSite.class);
+ builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + port + uri);
+ ResponseEntity<String> cloudSiteString =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
System.out.println(cloudSiteString.getBody());
assertEquals(Response.Status.OK.getStatusCode(), actualCloudSite.getStatusCode().value());
assertThat(actualCloudSite.getBody(), sameBeanAs(cloudSite).ignoring("created").ignoring("updated")
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
index e6a281a375..440270e047 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
@@ -26,11 +26,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
import java.util.List;
-
import javax.transaction.Transactional;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -53,102 +50,103 @@ import org.springframework.test.context.junit4.SpringRunner;
public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTest {
- private static final Logger logger = LoggerFactory.getLogger(NetworkCollectionCatalogDbQueryTest.class);
- private static final String NETWORKCOLLECTION = "NetworkCollection";
-
- private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private static final Logger logger = LoggerFactory.getLogger(NetworkCollectionCatalogDbQueryTest.class);
+ private static final String NETWORKCOLLECTION = "NetworkCollection";
+
+ private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+
+ @LocalServerPort
+ private int port;
+ boolean isInitialized;
+
+ @Autowired
+ CatalogDbClientPortChanger client;
+
+ @Before
+ public void initialize() {
+ client.wiremockPort = String.valueOf(port);
+ }
+
+ @Test
+ @Transactional
+ public void networkCollectionTest() {
+ logger.debug("TEST IS STARTING UP...");
+ String modelUUID = "4694a55f-58b3-4f17-92a5-796d6f5ffd0d";
+ boolean found = false;
+ logger.debug(Integer.toString(port));
+ InstanceGroup instanceGroup = null;
+ List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupList = null;
+ org.onap.so.db.catalog.beans.Service service = client.getServiceByID(modelUUID);
+ if (service == null) {
+ logger.debug("null");
+ } else {
+ List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if (customizations.isEmpty()) {
+ logger.debug("No Network Collection found. CollectionResourceCustomizations is empty");
+ }
+ for (CollectionResourceCustomization crc : customizations) {
+ if (client.getNetworkCollectionResourceCustomizationByID(
+ crc.getModelCustomizationUUID()) instanceof NetworkCollectionResourceCustomization) {
+ if (crc.getCollectionResource() != null) {
+ if (crc.getCollectionResource().getToscaNodeType() != null) {
+ String toscaNodeType = crc.getCollectionResource().getToscaNodeType();
+ if (toscaNodeType.contains(NETWORKCOLLECTION)) {
+ logger.debug("Found a network collection");
+ instanceGroup = crc.getCollectionResource().getInstanceGroup();
+ collectionInstanceGroupList = instanceGroup.getCollectionInstanceGroupCustomizations();
+ CollectionNetworkResourceCustomization collectionNetworkCust =
+ instanceGroup.getCollectionNetworkResourceCustomizations().get(0);
+ logger.debug("Found Collection Network Resource Customization: "
+ + collectionNetworkCust.getModelCustomizationUUID());
+ } else {
+ logger.debug(
+ "No Network Collection found. toscaNodeType does not contain NetworkCollection");
+ }
+ } else {
+ logger.debug("No Network Collection found. toscaNodeType is null");
+ }
+ } else {
+ logger.debug("No Network Collection found. collectionResource is null");
+ }
+ found = true;
+ } else {
+ logger.debug("Not a Network Collection Resource Customization Instance");
+ }
+ }
+ }
+ assertEquals("Number of CollectionResourceInstanceGroupCustomization in list", 2,
+ collectionInstanceGroupList.size());
+ assertNotNull(instanceGroup);
+ assertTrue(found);
+ }
- @LocalServerPort
- private int port;
- boolean isInitialized;
+ @Test
+ public void buildingBlockDetailTest() {
+ logger.debug("TEST IS STARTING UP...");
+ logger.debug(Integer.toString(port));
+ String buildingBlockFlowName = "CreateNetworkCollectionBB";
+ BuildingBlockDetail buildingBlockDetail = client.getBuildingBlockDetail(buildingBlockFlowName);
+ logger.debug("" + buildingBlockDetail.getResourceType());
+ assertNotNull(buildingBlockDetail);
+ }
- @Autowired
- CatalogDbClientPortChanger client;
+ @Test
+ public void fetchServiceTopology_Test() {
+ org.onap.so.db.catalog.beans.Service service = client.getServiceByID(serviceUUID);
- @Before
- public void initialize(){
- client.wiremockPort= String.valueOf(port);
- }
-
- @Test
- @Transactional
- public void networkCollectionTest() {
- logger.debug("TEST IS STARTING UP...");
- String modelUUID = "4694a55f-58b3-4f17-92a5-796d6f5ffd0d";
- boolean found = false;
- logger.debug(Integer.toString(port));
- InstanceGroup instanceGroup = null;
- List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupList = null;
- org.onap.so.db.catalog.beans.Service service = client.getServiceByID(modelUUID);
- if (service == null) {
- logger.debug("null");
- } else {
- List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
- if (customizations.isEmpty()) {
- logger.debug("No Network Collection found. CollectionResourceCustomizations is empty");
- }
- for (CollectionResourceCustomization crc : customizations) {
- if(client.getNetworkCollectionResourceCustomizationByID(crc.getModelCustomizationUUID())
- instanceof NetworkCollectionResourceCustomization) {
- if (crc.getCollectionResource() != null) {
- if (crc.getCollectionResource()
- .getToscaNodeType() != null) {
- String toscaNodeType = crc.getCollectionResource()
- .getToscaNodeType();
- if (toscaNodeType.contains(NETWORKCOLLECTION)) {
- logger.debug("Found a network collection");
- instanceGroup = crc.getCollectionResource().getInstanceGroup();
- collectionInstanceGroupList =
- instanceGroup.getCollectionInstanceGroupCustomizations();
- CollectionNetworkResourceCustomization collectionNetworkCust = instanceGroup.getCollectionNetworkResourceCustomizations().get(0);
- logger.debug("Found Collection Network Resource Customization: " + collectionNetworkCust.getModelCustomizationUUID());
- } else {
- logger.debug(
- "No Network Collection found. toscaNodeType does not contain NetworkCollection");
- }
- } else {
- logger.debug("No Network Collection found. toscaNodeType is null");
- }
- } else {
- logger.debug("No Network Collection found. collectionResource is null");
- }
- found = true;
- } else {
- logger.debug("Not a Network Collection Resource Customization Instance");
- }
- }
- }
- assertEquals("Number of CollectionResourceInstanceGroupCustomization in list", 2, collectionInstanceGroupList.size());
- assertNotNull(instanceGroup);
- assertTrue(found);
- }
-
- @Test
- public void buildingBlockDetailTest() {
- logger.debug("TEST IS STARTING UP...");
- logger.debug(Integer.toString(port));
- String buildingBlockFlowName = "CreateNetworkCollectionBB";
- BuildingBlockDetail buildingBlockDetail = client.getBuildingBlockDetail(buildingBlockFlowName);
- logger.debug("" + buildingBlockDetail.getResourceType());
- assertNotNull(buildingBlockDetail);
- }
-
- @Test
- public void fetchServiceTopology_Test() {
- org.onap.so.db.catalog.beans.Service service = client.getServiceByID(serviceUUID);
+ if (service == null) {
+ fail("Service is null");
+ }
+ assertEquals(serviceUUID, service.getModelUUID());
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
+ }
- if (service == null) {
- fail("Service is null");
- }
- assertEquals(serviceUUID, service.getModelUUID());
- assertEquals("MSOTADevInfra_vSAMP10a_Service",service.getModelName());
- }
-
- @Test
- public void CollectionNetworkResourceCustomizationTest() {
- String modelCustId = "1a61be4b-3378-4c9a-91c8-c919519b2d01";
- CollectionNetworkResourceCustomization collectionNetworkCust = client.getCollectionNetworkResourceCustomizationByID(modelCustId);
- assertNotNull(collectionNetworkCust);
- logger.debug(collectionNetworkCust.getModelCustomizationUUID());
- }
+ @Test
+ public void CollectionNetworkResourceCustomizationTest() {
+ String modelCustId = "1a61be4b-3378-4c9a-91c8-c919519b2d01";
+ CollectionNetworkResourceCustomization collectionNetworkCust =
+ client.getCollectionNetworkResourceCustomizationByID(modelCustId);
+ assertNotNull(collectionNetworkCust);
+ logger.debug(collectionNetworkCust.getModelCustomizationUUID());
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
index e403867c42..8fae1c2900 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java
@@ -22,7 +22,6 @@ package org.onap.so.adapters.catalogdb.catalogrest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -62,7 +61,7 @@ public class QueryResourceRecipeTest {
}
private Recipe createRecipe() {
- ServiceRecipe recipe = new ServiceRecipe();
+ ServiceRecipe recipe = new ServiceRecipe();
recipe.setId(RECIPE_ID);
recipe.setAction(RECIPE_ACTION);
recipe.setOrchestrationUri(RECIPE_URI);
@@ -76,8 +75,9 @@ public class QueryResourceRecipeTest {
public void convertToJson() {
Recipe recipe = createRecipe();
QueryResourceRecipe queryResourceRecipe = new QueryResourceRecipe(recipe);
- assertEquals("{\"orchestrationUri\":\"uriTest\",\"action\":\"actionTest\",\"description\":\"descrTest\",\"id\":\"123\",\"recipeTimeout\":\"100\",\"paramXSD\":\"paramsXsdTest\"}",
- queryResourceRecipe.JSON2(false,false));
+ assertEquals(
+ "{\"orchestrationUri\":\"uriTest\",\"action\":\"actionTest\",\"description\":\"descrTest\",\"id\":\"123\",\"recipeTimeout\":\"100\",\"paramXSD\":\"paramsXsdTest\"}",
+ queryResourceRecipe.JSON2(false, false));
}
@Test
@@ -86,10 +86,11 @@ public class QueryResourceRecipeTest {
QueryResourceRecipe networkQueryRR = new QueryResourceRecipe(new NetworkRecipe());
QueryResourceRecipe arQueryRR = new QueryResourceRecipe(new ArRecipe());
- String expected = "{\"orchestrationUri\":\"\",\"action\":\"\",\"description\":\"\",\"id\":\"\",\"recipeTimeout\":\"\",\"paramXSD\":\"\"}";
+ String expected =
+ "{\"orchestrationUri\":\"\",\"action\":\"\",\"description\":\"\",\"id\":\"\",\"recipeTimeout\":\"\",\"paramXSD\":\"\"}";
assertEquals(expected, vnfQueryRR.JSON2(false, false));
- assertEquals(expected, networkQueryRR.JSON2(false,false));
- assertEquals(expected, arQueryRR.JSON2(false,false));
+ assertEquals(expected, networkQueryRR.JSON2(false, false));
+ assertEquals(expected, arQueryRR.JSON2(false, false));
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java
index 32cc2946db..44e5998404 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java
@@ -21,7 +21,6 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.assertj.core.api.Assertions.assertThat;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.so.db.catalog.beans.ToscaCsar;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java
index 98e90c828c..cf0a06e8b0 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java
@@ -21,10 +21,8 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.assertj.core.api.Assertions.assertThat;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.VfModule;
@@ -52,8 +50,7 @@ public class QueryVfModuleTest {
.contains(VF_MODEL_UUID);
assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].modelInfo.modelInvariantUuid"))
.contains(VF_MODULE_INVARIANT_UUID);
- assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].isBase"))
- .contains("true");
+ assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].isBase")).contains("true");
assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].vfModuleLabel"))
.contains(VF_MODEL_CUSTOMIZATION_LABEL);
assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vfModules[0].initialCount"))
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java
index c5772d9883..0fcb73beab 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java
@@ -27,11 +27,11 @@ import ch.qos.logback.core.AppenderBase;
-public class TestAppender extends AppenderBase<ILoggingEvent> {
+public class TestAppender extends AppenderBase<ILoggingEvent> {
static List<ILoggingEvent> events = new ArrayList<>();
-
- @Override
- protected void append(ILoggingEvent loggingEvent) {
- events.add(loggingEvent);
- }
+
+ @Override
+ protected void append(ILoggingEvent loggingEvent) {
+ events.add(loggingEvent);
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
index e38bd02069..14498b6617 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
@@ -21,7 +21,6 @@
package org.onap.so.db.catalog.client;
import org.springframework.stereotype.Component;
-
import java.net.URI;
@Component()
@@ -29,7 +28,7 @@ public class CatalogDbClientPortChanger extends CatalogDbClient {
public String wiremockPort;
- CatalogDbClientPortChanger(){
+ CatalogDbClientPortChanger() {
}
@@ -44,6 +43,6 @@ public class CatalogDbClientPortChanger extends CatalogDbClient {
String prefix = "http://localhost:" + wiremockPort;
String query = uri.getQuery();
- return URI.create(prefix + path + (query == null || query.isEmpty()?"":"?"+query));
+ return URI.create(prefix + path + (query == null || query.isEmpty() ? "" : "?" + query));
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 763b3441fb..e1152bad4a 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -24,7 +24,6 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
import java.util.List;
import java.util.UUID;
import org.junit.Assert;
@@ -82,17 +81,17 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep() {
- RainyDayHandlerStatus rainyDayHandlerStatus = client
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "*", "*", "*", "*");
+ RainyDayHandlerStatus rainyDayHandlerStatus =
+ client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ "AssignServiceInstanceBB", "*", "*", "*", "*");
Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound() {
- RainyDayHandlerStatus rainyDayHandlerStatus = client
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- UUID.randomUUID().toString(), "*", "*", "*", "*");
+ RainyDayHandlerStatus rainyDayHandlerStatus =
+ client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ UUID.randomUUID().toString(), "*", "*", "*", "*");
Assert.assertNull(rainyDayHandlerStatus);
}
@@ -184,8 +183,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetVnfResourceCustomizationByModelCustomizationUUID() {
- VnfResourceCustomization vnfResourceCustomization = client
- .getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
+ VnfResourceCustomization vnfResourceCustomization =
+ client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
Assert.assertNotNull(vnfResourceCustomization);
Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
@@ -197,8 +196,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() {
- VnfResourceCustomization vnfResourceCustomization = client
- .getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ VnfResourceCustomization vnfResourceCustomization =
+ client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
Assert.assertNull(vnfResourceCustomization);
}
@@ -208,13 +207,13 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
Assert.assertNotNull(instanceGroup);
Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
- instanceGroup.getToscaNodeType().toString());
+ instanceGroup.getToscaNodeType().toString());
}
@Test
public void testGetVfModuleCustomizationByModelCuztomizationUUID() {
- VfModuleCustomization vfModuleCustomization = client
- .getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
+ VfModuleCustomization vfModuleCustomization =
+ client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
Assert.assertNotNull(vfModuleCustomization);
Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
Assert.assertEquals("base", vfModuleCustomization.getLabel());
@@ -222,15 +221,15 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() {
- VfModuleCustomization vfModuleCustomization = client
- .getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
+ VfModuleCustomization vfModuleCustomization =
+ client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
Assert.assertNull(vfModuleCustomization);
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUID() {
- NetworkResourceCustomization networkResourceCustomization = client
- .getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
+ NetworkResourceCustomization networkResourceCustomization =
+ client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
Assert.assertNotNull(networkResourceCustomization);
Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
@@ -239,16 +238,16 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() {
- NetworkResourceCustomization networkResourceCustomization = client
- .getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ NetworkResourceCustomization networkResourceCustomization =
+ client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
Assert.assertNull(networkResourceCustomization);
}
@Test
public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID() {
- VfModuleCustomization vfModuleCustomization = client
- .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
- "cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
+ VfModuleCustomization vfModuleCustomization =
+ client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ "cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
Assert.assertNotNull(vfModuleCustomization);
Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
Assert.assertNotNull(vfModuleCustomization.getVfModule());
@@ -257,35 +256,35 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUIDNotFound() {
- VfModuleCustomization vfModuleCustomization = client
- .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
- "cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
+ VfModuleCustomization vfModuleCustomization =
+ client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ "cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
Assert.assertNull(vfModuleCustomization);
}
@Test
public void testGetFirstByServiceModelUUIDAndAction() {
- ServiceRecipe serviceRecipe = client
- .getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
+ ServiceRecipe serviceRecipe =
+ client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
Assert.assertNotNull(serviceRecipe);
Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
Assert.assertNotNull(serviceRecipe.getAction());
Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
+ serviceRecipe.getOrchestrationUri());
Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testGetFirstByServiceModelUUIDAndActionNotFound() {
- ServiceRecipe serviceRecipe = client
- .getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString());
+ ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671",
+ UUID.randomUUID().toString());
Assert.assertNull(serviceRecipe);
}
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() {
VnfResource vnfResource = client
- .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
+ .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
Assert.assertNotNull(vnfResource);
Assert.assertNotNull(vnfResource.getModelInvariantId());
Assert.assertNotNull(vnfResource.getModelVersion());
@@ -296,9 +295,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() {
- VnfResource vnfResource = client
- .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671",
- UUID.randomUUID().toString());
+ VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
+ "2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString());
Assert.assertNull(vnfResource);
}
@@ -306,15 +304,15 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources() {
VnfResource vnfr = new VnfResource();
vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
- VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client
- .getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
+ VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources =
+ client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
Assert.assertEquals("vSAMP10a 1",
- firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
+ firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
- Assert
- .assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
+ Assert.assertNotNull(
+ firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
}
@Test
@@ -335,9 +333,9 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction() {
- VnfComponentsRecipe vnfComponentsRecipe = client
- .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- "20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
+ VnfComponentsRecipe vnfComponentsRecipe =
+ client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ "20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
Assert.assertNotNull(vnfComponentsRecipe);
Assert.assertNotNull(vnfComponentsRecipe.getAction());
Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
@@ -350,28 +348,28 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndActionNotFound() {
- VnfComponentsRecipe vnfComponentsRecipe = client
- .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(),
- "volumeGroup", "createInstance");
+ VnfComponentsRecipe vnfComponentsRecipe =
+ client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ UUID.randomUUID().toString(), "volumeGroup", "createInstance");
Assert.assertNull(vnfComponentsRecipe);
}
@Test
public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() {
- VnfComponentsRecipe vnfComponentsRecipe = client
- .getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
+ VnfComponentsRecipe vnfComponentsRecipe =
+ client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
Assert.assertNotNull(vnfComponentsRecipe);
Assert.assertNotNull(vnfComponentsRecipe.getAction());
Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
- Assert
- .assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
+ Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1",
+ vnfComponentsRecipe.getOrchestrationUri());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUID() {
- Service service = client
- .getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
+ Service service =
+ client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
Assert.assertNotNull(service);
Assert.assertNotNull(service.getModelVersion());
Assert.assertNotNull(service.getModelInvariantUUID());
@@ -387,8 +385,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersion() {
- VfModule vfModule = client
- .getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
+ VfModule vfModule =
+ client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
Assert.assertNotNull(vfModule);
Assert.assertNotNull(vfModule.getModelVersion());
Assert.assertNotNull(vfModule.getModelInvariantUUID());
@@ -404,8 +402,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() {
- List<Service> serviceList = client
- .getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
+ List<Service> serviceList =
+ client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
Assert.assertFalse(serviceList.isEmpty());
Assert.assertEquals(2, serviceList.size());
Service service = serviceList.get(0);
@@ -414,15 +412,15 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() {
- List<Service> serviceList = client
- .getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
+ List<Service> serviceList =
+ client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
Assert.assertTrue(serviceList.isEmpty());
}
@Test
public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() {
- List<VfModule> moduleList = client
- .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
+ List<VfModule> moduleList =
+ client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
Assert.assertFalse(moduleList.isEmpty());
Assert.assertEquals(2, moduleList.size());
VfModule module = moduleList.get(0);
@@ -432,7 +430,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testPostCloudSite() {
CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger(
- "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
+ "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
CloudSite cloudSite = new CloudSite();
cloudSite.setId("MTN6");
cloudSite.setClli("TESTCLLI");
@@ -471,60 +469,22 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testPostHomingInstance() {
CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger(
- "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
+ "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
HomingInstance homingInstance = new HomingInstance();
homingInstance.setServiceInstanceId("5df8d6be-2083-11e7-93ae-92361f232671");
homingInstance.setCloudOwner("CloudOwner-1");
homingInstance.setCloudRegionId("CloudRegionOne");
- homingInstance.setOofDirectives("{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"attributes\": [\n" +
- "{\n" +
- "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
- "\"attribute_name\": \"firewall_flavor_name\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"flavor_directives\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"vnfc\",\n" +
- "\"id\": \"vfw\"\n" +
- "},\n" +
- "{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"attributes\": [\n" +
- "{\n" +
- "\"attribute_value\": \"onap.hpa.flavor32\",\n" +
- "\"attribute_name\": \"packetgen_flavor_name\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"flavor_directives\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"vnfc\",\n" +
- "\"id\": \"vgenerator\"\n" +
- "},\n" +
- "{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"attributes\": [\n" +
- "{\n" +
- "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
- "\"attribute_name\": \"sink_flavor_name\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"flavor_directives\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"vnfc\",\n" +
- "\"id\": \"vsink\"\n" +
- "}\n" +
- "]\n" +
- "}");
+ homingInstance.setOofDirectives("{\n" + "\"directives\": [\n" + "{\n" + "\"directives\": [\n" + "{\n"
+ + "\"attributes\": [\n" + "{\n" + "\"attribute_value\": \"onap.hpa.flavor31\",\n"
+ + "\"attribute_name\": \"firewall_flavor_name\"\n" + "}\n" + "],\n"
+ + "\"type\": \"flavor_directives\"\n" + "}\n" + "],\n" + "\"type\": \"vnfc\",\n" + "\"id\": \"vfw\"\n"
+ + "},\n" + "{\n" + "\"directives\": [\n" + "{\n" + "\"attributes\": [\n" + "{\n"
+ + "\"attribute_value\": \"onap.hpa.flavor32\",\n" + "\"attribute_name\": \"packetgen_flavor_name\"\n"
+ + "}\n" + "],\n" + "\"type\": \"flavor_directives\"\n" + "}\n" + "],\n" + "\"type\": \"vnfc\",\n"
+ + "\"id\": \"vgenerator\"\n" + "},\n" + "{\n" + "\"directives\": [\n" + "{\n" + "\"attributes\": [\n"
+ + "{\n" + "\"attribute_value\": \"onap.hpa.flavor31\",\n" + "\"attribute_name\": \"sink_flavor_name\"\n"
+ + "}\n" + "],\n" + "\"type\": \"flavor_directives\"\n" + "}\n" + "],\n" + "\"type\": \"vnfc\",\n"
+ + "\"id\": \"vsink\"\n" + "}\n" + "]\n" + "}");
localClient.postHomingInstance(homingInstance);
HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671");
Assert.assertNotNull(getHomingInstance);
@@ -574,7 +534,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
northBoundRequest.setIsAlacarte(true);
northBoundRequest.setCloudOwner("my-custom-cloud-owner");
client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true,
- "my-custom-cloud-owner");
+ "my-custom-cloud-owner");
Assert.assertNotNull(northBoundRequest);
Assert.assertEquals("createService", northBoundRequest.getAction());
Assert.assertEquals("service", northBoundRequest.getRequestScope());
@@ -584,27 +544,27 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testFindServiceRecipeByActionAndServiceModelUUID() {
- ServiceRecipe serviceRecipe = client
- .findServiceRecipeByActionAndServiceModelUUID("createInstance", "4694a55f-58b3-4f17-92a5-796d6f5ffd0d");
+ ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance",
+ "4694a55f-58b3-4f17-92a5-796d6f5ffd0d");
Assert.assertNotNull(serviceRecipe);
Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
Assert.assertNotNull(serviceRecipe.getAction());
Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
+ serviceRecipe.getOrchestrationUri());
Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() {
- ServiceRecipe serviceRecipe = client
- .findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test");
+ ServiceRecipe serviceRecipe =
+ client.findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test");
Assert.assertNull(serviceRecipe);
}
@Test
public void testFindExternalToInternalServiceByServiceName() {
- ExternalServiceToInternalService externalServiceToInternalService = client
- .findExternalToInternalServiceByServiceName("MySpecialServiceName");
+ ExternalServiceToInternalService externalServiceToInternalService =
+ client.findExternalToInternalServiceByServiceName("MySpecialServiceName");
Assert.assertNotNull(externalServiceToInternalService);
Assert.assertNotNull(externalServiceToInternalService.getServiceName());
Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID());
@@ -613,8 +573,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testFindExternalToInternalServiceByServiceNameNotFound() {
- ExternalServiceToInternalService externalServiceToInternalService = client
- .findExternalToInternalServiceByServiceName("Not_Found");
+ ExternalServiceToInternalService externalServiceToInternalService =
+ client.findExternalToInternalServiceByServiceName("Not_Found");
Assert.assertNull(externalServiceToInternalService);
}
@@ -624,7 +584,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
Assert.assertNotNull(pnfResource);
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
- pnfResource.getModelInvariantUUID());
+ pnfResource.getModelInvariantUUID());
assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
}
@@ -637,8 +597,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getPnfResourceCustomizationByModelCustomizationUUID_validUuid_expectedOutput() {
- PnfResourceCustomization pnfResourceCustomization = client
- .getPnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002680");
+ PnfResourceCustomization pnfResourceCustomization =
+ client.getPnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002680");
assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
@@ -647,25 +607,25 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertNotNull(pnfResource);
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
- pnfResource.getModelInvariantUUID());
+ pnfResource.getModelInvariantUUID());
assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
}
@Test
public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() {
- PnfResourceCustomization pnfResourceCustomization = client
- .getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ PnfResourceCustomization pnfResourceCustomization =
+ client.getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
Assert.assertNull(pnfResourceCustomization);
}
@Test
public void getPnfResourceCustomizationFromJoinTable_validServiceUuid_expectedOutput() {
- List<PnfResourceCustomization> pnfResourceCustomizationList = client
- .getPnfResourceCustomizationByModelUuid("5df8b6de-2083-11e7-93ae-92361f002676");
+ List<PnfResourceCustomization> pnfResourceCustomizationList =
+ client.getPnfResourceCustomizationByModelUuid("5df8b6de-2083-11e7-93ae-92361f002676");
assertEquals(1, pnfResourceCustomizationList.size());
- PnfResourceCustomization pnfResourceCustomization= pnfResourceCustomizationList.get(0);
+ PnfResourceCustomization pnfResourceCustomization = pnfResourceCustomizationList.get(0);
assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
@@ -674,29 +634,27 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
- pnfResource.getModelInvariantUUID());
+ pnfResource.getModelInvariantUUID());
assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
}
@Test
public void getPnfResourceCustomizationFromJoinTable_invalidServiceUuid_nullOutput() {
- List<PnfResourceCustomization> pnfResourceCustomizationList = client
- .getPnfResourceCustomizationByModelUuid(UUID.randomUUID().toString());
+ List<PnfResourceCustomization> pnfResourceCustomizationList =
+ client.getPnfResourceCustomizationByModelUuid(UUID.randomUUID().toString());
assertEquals(0, pnfResourceCustomizationList.size());
}
-
+
@Test
public void getWorkflowByArtifactUUID_validUuid_expectedOutput() {
- Workflow workflow = client
- .findWorkflowByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1");
+ Workflow workflow = client.findWorkflowByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1");
assertEquals("artifactName", "testingWorkflow", workflow.getArtifactName());
}
@Test
public void getWorkflowByArtifactUUID_invalidUuid_nullOutput() {
- Workflow workflow = client
- .findWorkflowByArtifactUUID(UUID.randomUUID().toString());
+ Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
Assert.assertNull(workflow);
}