aboutsummaryrefslogtreecommitdiffstats
path: root/sliPluginUtils
diff options
context:
space:
mode:
authorSmokowski, Kevin (ks6305) <ks6305@att.com>2018-05-11 14:27:15 +0000
committerTimoney, Dan (dt5972) <dt5972@att.com>2018-06-06 15:55:26 -0400
commit88115d6cf23b4d836cb5637905d46412fb82c7e4 (patch)
treeda48770941eaffdc12097f8e6e4551cf78e2bc71 /sliPluginUtils
parent1a71779b7b1104ba6d5e289e6dc839bb4b9493d5 (diff)
dme2 plugin improvements
DME2 plugin itself will be coded to generic properties object not any custom object. The code is flexible so new query parameters can easily be added without code changes. Default properties which could previously not be overridden can now be overridden if desired. Change-Id: I56b4dfd4dee350198a23ac57c775bd1adacb1a9a Issue-ID: CCSDK-274 Signed-off-by: Smokowski, Kevin (ks6305) <ks6305@att.com>
Diffstat (limited to 'sliPluginUtils')
-rw-r--r--sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java296
-rw-r--r--sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Factory.java109
-rw-r--r--sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2PropertiesProvider.java278
-rw-r--r--sliPluginUtils/provider/src/main/resources/org/opendaylight/blueprint/slipluginutils-blueprint.xml37
-rw-r--r--sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java293
5 files changed, 462 insertions, 551 deletions
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java
index 6bdd87e2..5121e8a5 100644
--- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java
+++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/DME2.java
@@ -1,146 +1,150 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.core.slipluginutils;
-
-import java.util.Map;
-
-import java.util.Optional;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-
-/**
- * A SvcLogicJavaPlugin that generates DME2 proxy urls using parameters from context memory.
- */
-public class DME2 implements SvcLogicJavaPlugin {
-
- private static final Logger LOG = LoggerFactory.getLogger(DME2.class);
-
- final String aafUserName;
- final String aafPassword;
- final String envContext;
- final String routeOffer;
- final String[] proxyUrls;
- final String commonServiceVersion;
-
- Integer index;
- String partner;
-
-
- public void setPartner(String partner) {
- if (partner != null && partner.length() > 0) {
- this.partner = partner;
- }
- }
-
- public DME2(String aafUserName, String aafPassword, String envContext, String routeOffer, String[] proxyUrls, String commonServiceVersion) {
- this.aafUserName = aafUserName;
- this.aafPassword = aafPassword;
- this.envContext = envContext;
- this.routeOffer = routeOffer;
- this.proxyUrls = proxyUrls;
- this.index = 0;
- this.commonServiceVersion = commonServiceVersion;
- }
-
- public DME2(final Dme2PropertiesProvider provider) {
- this.aafUserName = useProperty(provider.getAafUsername(), Dme2PropertiesProvider.AAF_USERNAME_KEY);
- this.aafPassword = useProperty(provider.getAafPassword(), Dme2PropertiesProvider.AAF_PASSWORD_KEY);
- this.envContext = useProperty(provider.getEnvContext(), Dme2PropertiesProvider.ENV_CONTEXT_KEY);
- this.routeOffer = useProperty(provider.getRouteOffer(), Dme2PropertiesProvider.ROUTE_OFFER_KEY);
- this.index = 0;
- this.commonServiceVersion = useProperty(provider.getCommonServiceVersion(),
- Dme2PropertiesProvider.COMMON_SERVICE_VERSION_KEY);
-
- final Optional<String []> maybeProxyUrls = provider.getProxyUrls();
- if (maybeProxyUrls.isPresent()) {
- this.proxyUrls = maybeProxyUrls.get();
- } else {
- warnOfMissingProperty(Dme2PropertiesProvider.PROXY_URL_KEY);
- this.proxyUrls = null;
- }
- this.setPartner(useProperty(provider.getPartner(), Dme2PropertiesProvider.PARTNER_KEY));
- }
-
- private String useProperty(final Optional<String> propertyOptional, final String propertyKey) {
- if (propertyOptional.isPresent()) {
- return propertyOptional.get();
- }
- warnOfMissingProperty(propertyKey);
- return null;
- }
-
- private void warnOfMissingProperty(final String propertyName) {
- LOG.warn("Utilizing null for {} since it was left unassigned in the properties file");
- }
-
- // constructs a URL to contact the proxy which contacts a DME2 service
- public String constructUrl(String service, String version, String subContext) {
- StringBuilder sb = new StringBuilder();
-
- // The hostname is assigned in a round robin fashion
- sb.append(acquireHostName());
- sb.append("/service=" + service);
-
- //If the directedGraph passes an explicit version use that, if not use the commonServiceVersion found in the properties file
- if (version == null) {
- version = this.commonServiceVersion;
- }
- sb.append("/version=" + version);
-
- sb.append("/envContext=" + this.envContext);
- if (this.routeOffer != null && this.routeOffer.length() > 0) {
- sb.append("/routeOffer=" + this.routeOffer);
- }
- if (subContext != null && subContext.length() > 0) {
- sb.append("/subContext=" + subContext);
- }
- sb.append("?dme2.password=" + this.aafPassword);
- sb.append("&dme2.username=" + this.aafUserName);
- if (this.partner != null) {
- sb.append("&dme2.partner=" + this.partner);
- }
- sb.append("&dme2.allowhttpcode=true");
- return sb.toString();
- }
-
- public synchronized String acquireHostName() {
- String retVal = proxyUrls[index];
- index++;
- if (index == this.proxyUrls.length) {
- index = 0;
- }
- return retVal;
- }
-
- // Node entry point
- public void constructUrl(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException {
- SliPluginUtils.checkParameters(parameters, new String[] { "service", "outputPath" }, LOG);
- String completeProxyUrl = constructUrl(parameters.get("service"), parameters.get("version"), parameters.get("subContext"));
- ctx.setAttribute(parameters.get("outputPath"), completeProxyUrl);
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.slipluginutils;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A SvcLogicJavaPlugin that generates DME2 proxy urls (for calling the DME2 ingress proxy) using
+ * parameters from context memory.
+ */
+public class DME2 implements SvcLogicJavaPlugin {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DME2.class);
+ // the key for <code>proxyUrl</code>, which represents a CSV list of urls
+ static final String PROXY_URL_KEY = "proxyUrl";
+ static final String PROXY_URLS_VALUE_SEPARATOR = ",";
+ static final String AAF_USERNAME_KEY = "aafUserName";
+ static final String AAF_PASSWORD_KEY = "aafPassword";
+ static final String ENV_CONTEXT_KEY = "envContext";
+ static final String ROUTE_OFFER_KEY = "routeOffer";
+ static final String COMMON_SERVICE_VERSION_KEY = "commonServiceVersion";
+ static final String PARTNER_KEY = "partner";
+ static final String VERSION_KEY = "version";
+ static final String SERVICE_KEY = "service";
+ static final String SUBCONTEXT_KEY = "subContext";
+ static final String ENDPOINT_READ_TIMEOUT_KEY = "endpointReadTimeout";
+ static final String OUTPUT_PATH_KEY = "outputPath";
+
+ final String aafUserName;
+ final String aafPassword;
+ final String envContext;
+ final String routeOffer;
+ final String[] proxyUrls;
+ final String commonServiceVersion;
+ final String partner;
+ final String endpointReadTimeout;
+ Integer index;
+
+ public DME2(Properties properties) {
+ Iterator<Entry<Object, Object>> it = properties.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<Object, Object> entry = it.next();
+ if (entry.getValue() == null || entry.getValue().toString().length() < 1) {
+ it.remove();
+ }
+ }
+ this.aafUserName = properties.getProperty(AAF_USERNAME_KEY, null);
+ this.aafPassword = properties.getProperty(AAF_PASSWORD_KEY, null);
+ this.envContext = properties.getProperty(ENV_CONTEXT_KEY, null);
+ this.routeOffer = properties.getProperty(ROUTE_OFFER_KEY, null);
+ this.commonServiceVersion = properties.getProperty(COMMON_SERVICE_VERSION_KEY, null);
+ this.partner = properties.getProperty(PARTNER_KEY, null);
+ this.endpointReadTimeout = properties.getProperty(ENDPOINT_READ_TIMEOUT_KEY, null);
+ String proxyUrlString = properties.getProperty(PROXY_URL_KEY, null);
+ if (proxyUrlString != null && proxyUrlString.length() > 0) {
+ this.proxyUrls = proxyUrlString.split(PROXY_URLS_VALUE_SEPARATOR);
+ } else {
+ String[] local = {"http://localhost:5000"};
+ this.proxyUrls = local;
+ }
+ this.index = 0;
+ }
+
+ // constructs a URL to contact the proxy which contacts a DME2 service
+ public String constructUrl(Map<String, String> parameters) {
+ StringBuilder sb = new StringBuilder();
+
+ // The hostname is assigned in a round robin fashion
+ sb.append(acquireHostName());
+ sb.append("/service=" + parameters.get(SERVICE_KEY));
+
+ // If the directedGraph passes an explicit version use that, if not use the commonServiceVersion
+ // found in the properties file
+ String version = parameters.getOrDefault(VERSION_KEY, this.commonServiceVersion);
+ sb.append("/version=" + version);
+ String envContext = parameters.getOrDefault(ENV_CONTEXT_KEY, this.envContext);
+ sb.append("/envContext=" + envContext);
+ String routeOffer = parameters.getOrDefault(ROUTE_OFFER_KEY, this.routeOffer);
+ sb.append("/routeOffer=" + routeOffer);
+
+ String subContext = parameters.get(SUBCONTEXT_KEY);
+ if (subContext != null && subContext.length() > 0) {
+ sb.append("/subContext=" + subContext);
+ }
+ sb.append("?dme2.password=" + this.aafPassword);
+ sb.append("&dme2.username=" + this.aafUserName);
+ if (this.partner != null) {
+ sb.append("&dme2.partner=" + this.partner);
+ }
+ sb.append("&dme2.allowhttpcode=true");
+ String endpointReadTimeout = parameters.getOrDefault(ENDPOINT_READ_TIMEOUT_KEY, this.endpointReadTimeout);
+ if (endpointReadTimeout != null) {
+ sb.append("&dme2.endpointReadTimeout=" + endpointReadTimeout);
+ }
+ String incompleteUrl = sb.toString();
+
+ // Support optional parameters in a flexible way
+ for (Entry<String, String> param : parameters.entrySet()) {
+ if (!incompleteUrl.contains(param.getKey() + "=") && param.getValue() != null
+ && param.getValue().length() > 0 && !OUTPUT_PATH_KEY.equals(param.getKey())) {
+ sb.append("&" + param.getKey() + "=" + param.getValue());
+ }
+ }
+ return sb.toString();
+ }
+
+ public synchronized String acquireHostName() {
+ String retVal = proxyUrls[index];
+ index++;
+ if (index == this.proxyUrls.length) {
+ index = 0;
+ }
+ return retVal;
+ }
+
+ // Node entry point
+ public void constructUrl(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException {
+ SliPluginUtils.checkParameters(parameters, new String[] {SERVICE_KEY, OUTPUT_PATH_KEY}, LOG);
+ String completeProxyUrl = constructUrl(parameters);
+ ctx.setAttribute(parameters.get(OUTPUT_PATH_KEY), completeProxyUrl);
+ }
+
+}
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Factory.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Factory.java
new file mode 100644
index 00000000..7013a9c5
--- /dev/null
+++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Factory.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.slipluginutils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.Vector;
+import org.onap.ccsdk.sli.core.utils.JREFileResolver;
+import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver;
+import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver;
+import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver;
+import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Immutable properties container for dme2 properties. Since the initial design decision was made to
+ * utilize <code>Properties</code> instead of an OSGi <code>ManagedService</code>, it was decided to
+ * make these properties immutable.
+ */
+public final class Dme2Factory {
+
+ private static final Logger LOG = LoggerFactory.getLogger(Dme2Factory.class);
+ private static final String DME2_PROPERTIES_FILE_NAME = "dme2.properties";
+
+ static Properties properties;
+ private Vector<PropertiesFileResolver> dme2PropertiesFileResolvers = new Vector<>();
+
+ public Dme2Factory() {
+ dme2PropertiesFileResolvers
+ .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable"));
+ dme2PropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory"));
+ dme2PropertiesFileResolvers
+ .add(new JREFileResolver("Using property file (3) from JRE argument", Dme2Factory.class));
+ dme2PropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this));
+ File dme2File = getDme2File(DME2_PROPERTIES_FILE_NAME);
+ init(dme2File);
+ }
+
+ private void init(final File dme2propertiesFile) {
+ try {
+ properties = getProperties(dme2propertiesFile);
+ } catch (final FileNotFoundException e) {
+ LOG.error("dme2.properties file could not be found at path: {}", dme2propertiesFile, e);
+ } catch (final IOException e) {
+ LOG.error("fatal error reading dme2.properties at path: {}", dme2propertiesFile, e);
+ }
+ }
+
+ /**
+ * Reports the method chosen for properties resolution to the <code>Logger</code>.
+ *
+ * @param message Some user friendly message
+ * @param fileOptional The file location of the chosen properties file
+ * @return the file location of the chosen properties file
+ */
+ private static File reportSuccess(final String message, final Optional<File> fileOptional) {
+ if (fileOptional.isPresent()) {
+ final File file = fileOptional.get();
+ LOG.info("{} {}", message, file.getPath());
+ return file;
+ }
+ return null;
+ }
+
+ private File getDme2File(final String dme2Filename) {
+ for (final PropertiesFileResolver dblibPropertiesFileResolver : dme2PropertiesFileResolvers) {
+ final Optional<File> fileOptional = dblibPropertiesFileResolver.resolveFile(dme2Filename);
+ if (fileOptional.isPresent()) {
+ return reportSuccess(dblibPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional);
+ }
+ }
+ return (new File(dme2Filename));
+ }
+
+ private static Properties getProperties(final File dme2File) throws IOException {
+ final Properties properties = new Properties();
+ properties.load(new FileReader(dme2File));
+ return properties;
+ }
+
+ public DME2 createDme2() {
+ return new DME2(properties);
+ }
+
+}
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2PropertiesProvider.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2PropertiesProvider.java
deleted file mode 100644
index 6802c9a8..00000000
--- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2PropertiesProvider.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.core.slipluginutils;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Strings;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Optional;
-import java.util.Properties;
-import java.util.Vector;
-
-import org.onap.ccsdk.sli.core.utils.JREFileResolver;
-import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver;
-import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver;
-import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver;
-import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Immutable properties container for dme2 properties. Since the initial design
- * decision was made to utilize <code>Properties</code> instead of an OSGi
- * <code>ManagedService</code>, it was decided to make these properties
- * immutable.
- */
-public final class Dme2PropertiesProvider {
-
- private static final Logger LOG = LoggerFactory.getLogger(Dme2PropertiesProvider.class);
-
- /**
- * The name of the environment variable to specify the configuration directory.
- */
- private static final String SDNC_ROOT_DIR_ENV_VAR_KEY = "SDNC_CONFIG_DIR";
-
- /**
- * the dme2 properties file name.
- */
- private static final String DME2_PROPERTIES_FILE_NAME = "dme2.properties";
-
- /**
- * the key for <code>proxyUrl</code>, which represents a CSV list of urls
- */
- static final String PROXY_URL_KEY = "proxyUrl";
-
- /**
- * indicates that proxy urls are separated by commas
- */
- private static final String PROXY_URLS_VALUE_SEPARATOR = ",";
-
- /**
- * the key for <code>aafUserName</code>
- */
- static final String AAF_USERNAME_KEY = "aafUserName";
-
- /**
- * the key for <code>aafPassword</code>
- */
- static final String AAF_PASSWORD_KEY = "aafPassword";
-
- /**
- * the key for <code>envContext</code>
- */
- static final String ENV_CONTEXT_KEY = "envContext";
-
- /**
- * the key for <code>routeOffer</code>
- */
- static final String ROUTE_OFFER_KEY = "routeOffer";
-
- /**
- * the key for <code>commonServiceVersion</code>
- */
- static final String COMMON_SERVICE_VERSION_KEY = "commonServiceVersion";
-
- /**
- * the key for <code>partner</code>
- */
- static final String PARTNER_KEY = "partner";
-
- private Optional<String[]> proxyUrls = Optional.empty();
-
- private Optional<String> aafUsername = Optional.empty();
-
- private Optional<String> aafPassword = Optional.empty();
-
- private Optional<String> envContext = Optional.empty();
-
- private Optional<String> routeOffer = Optional.empty();
-
- private Optional<String> commonServiceVersion = Optional.empty();
-
- private Optional<String> partner = Optional.empty();
-
- /**
- * A prioritized list of strategies for resolving dme2 properties files.
- */
- private Vector<PropertiesFileResolver> dme2PropertiesFileResolvers = new Vector<>();
-
- /**
- * Instantiates the properties provider, which involves loading the appropriate
- * properties for dme2.
- */
- public Dme2PropertiesProvider() {
- this(DME2_PROPERTIES_FILE_NAME);
- }
-
- /**
- * Instantiates the properties provider, which involves loading the appropriate
- * properties for dme2.
- *
- * @param dme2Path
- * location of the dme2.properties file
- */
- @VisibleForTesting
- Dme2PropertiesProvider(final String dme2FileName) {
- dme2PropertiesFileResolvers
- .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable"));
- dme2PropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory"));
-
- dme2PropertiesFileResolvers
- .add(new JREFileResolver("Using property file (3) from JRE argument", Dme2PropertiesProvider.class));
- dme2PropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this));
-
- File dme2File = getDme2File(dme2FileName);
-
- init(dme2File);
- }
-
- private void init(final File dme2Path) {
- final Properties properties;
- try {
- properties = getProperties(dme2Path);
- this.proxyUrls = getProxyUrls(properties);
- this.aafUsername = getAafUsername(properties);
- this.aafPassword = getAafPassword(properties);
- this.envContext = getEnvContext(properties);
- this.routeOffer = getRouteOffer(properties);
- this.commonServiceVersion = getCommonServiceVersion(properties);
- this.partner = getPartner(properties);
- } catch (final FileNotFoundException e) {
-
- LOG.error("dme2.properties file could not be found at path: {}", dme2Path, e);
- } catch (final IOException e) {
- LOG.error("fatal error reading dme2.properties at path: {}", dme2Path, e);
- }
- }
-
- /**
- * Reports the method chosen for properties resolution to the
- * <code>Logger</code>.
- *
- * @param message
- * Some user friendly message
- * @param fileOptional
- * The file location of the chosen properties file
- * @return the file location of the chosen properties file
- */
- private static File reportSuccess(final String message, final Optional<File> fileOptional) {
- if (fileOptional.isPresent()) {
- final File file = fileOptional.get();
- LOG.info("{} {}", message, file.getPath());
- return file;
- }
- return null;
- }
-
- private File getDme2File(final String dme2Filename) {
-
- for (final PropertiesFileResolver dblibPropertiesFileResolver : dme2PropertiesFileResolvers) {
- final Optional<File> fileOptional = dblibPropertiesFileResolver.resolveFile(dme2Filename);
- if (fileOptional.isPresent()) {
- return reportSuccess(dblibPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional);
- }
- }
- return (new File(dme2Filename));
- }
-
- private static Properties getProperties(final File dme2File) throws IOException {
-
- final Properties properties = new Properties();
- properties.load(new FileReader(dme2File));
- return properties;
- }
-
- private String getProxyUrl(final Properties properties) {
- return properties.getProperty(PROXY_URL_KEY);
- }
-
- private Optional<String[]> getProxyUrls(final Properties properties) {
- final String proxyUrlsValue = getProxyUrl(properties);
- if (!Strings.isNullOrEmpty(proxyUrlsValue)) {
- return Optional.ofNullable(proxyUrlsValue.split(PROXY_URLS_VALUE_SEPARATOR));
- }
- return Optional.empty();
- }
-
- public Optional<String[]> getProxyUrls() {
- return this.proxyUrls;
- }
-
- private Optional<String> getAafUsername(final Properties properties) {
- final String aafUsernameValue = properties.getProperty(AAF_USERNAME_KEY);
- return Optional.ofNullable(aafUsernameValue);
- }
-
- Optional<String> getAafUsername() {
- return this.aafUsername;
- }
-
- private Optional<String> getAafPassword(final Properties properties) {
- final String aafPassword = properties.getProperty(AAF_PASSWORD_KEY);
- return Optional.ofNullable(aafPassword);
- }
-
- Optional<String> getAafPassword() {
- return this.aafPassword;
- }
-
- private Optional<String> getEnvContext(final Properties properties) {
- final String envContext = properties.getProperty(ENV_CONTEXT_KEY);
- return Optional.ofNullable(envContext);
- }
-
- Optional<String> getEnvContext() {
- return this.envContext;
- }
-
- private Optional<String> getRouteOffer(final Properties properties) {
- final String routeOffer = properties.getProperty(ROUTE_OFFER_KEY);
- return Optional.ofNullable(routeOffer);
- }
-
- Optional<String> getRouteOffer() {
- return this.routeOffer;
- }
-
- private Optional<String> getCommonServiceVersion(final Properties properties) {
- final String commonServiceVersion = properties.getProperty(COMMON_SERVICE_VERSION_KEY);
- return Optional.ofNullable(commonServiceVersion);
- }
-
- Optional<String> getCommonServiceVersion() {
- return this.commonServiceVersion;
- }
-
- private Optional<String> getPartner(final Properties properties) {
- final String partner = properties.getProperty(PARTNER_KEY);
- return Optional.ofNullable(partner);
- }
-
- Optional<String> getPartner() {
- return this.partner;
- }
-}
diff --git a/sliPluginUtils/provider/src/main/resources/org/opendaylight/blueprint/slipluginutils-blueprint.xml b/sliPluginUtils/provider/src/main/resources/org/opendaylight/blueprint/slipluginutils-blueprint.xml
index c0952d2a..283dbbaa 100644
--- a/sliPluginUtils/provider/src/main/resources/org/opendaylight/blueprint/slipluginutils-blueprint.xml
+++ b/sliPluginUtils/provider/src/main/resources/org/opendaylight/blueprint/slipluginutils-blueprint.xml
@@ -1,19 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
-
- <bean id="sliPluginUtils" class="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" />
- <service ref="sliPluginUtils" interface="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" />
-
- <bean id="sliStringUtils" class="org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils" />
- <service ref="sliStringUtils" interface="org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils" />
-
- <bean id="dme2Properties" class="org.onap.ccsdk.sli.core.slipluginutils.Dme2PropertiesProvider" />
- <bean id="dme2" class="org.onap.ccsdk.sli.core.slipluginutils.DME2">
- <argument ref="dme2Properties" />
- </bean>
- <service ref="dme2" interface="org.onap.ccsdk.sli.core.slipluginutils.DME2" />
-
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="sliPluginUtils" class="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" />
+ <service ref="sliPluginUtils"
+ interface="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" />
+
+ <bean id="sliStringUtils" class="org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils" />
+ <service ref="sliStringUtils"
+ interface="org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils" />
+
+ <bean id="dme2Factory" class="org.onap.ccsdk.sli.core.slipluginutils.Dme2Factory" />
+ <bean id="dme2" class="org.onap.ccsdk.sli.core.slipluginutils.DME2"
+ factory-ref="dme2Factory" factory-method="createDme2" />
+
+ <service ref="dme2" interface="org.onap.ccsdk.sli.core.slipluginutils.DME2" />
+
</blueprint> \ No newline at end of file
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java
index d19fbec4..662df75d 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/Dme2Test.java
@@ -1,109 +1,184 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.core.slipluginutils;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class Dme2Test {
-
- @Test
- public void createInstarUrl() {
- String instarUrl = "http://localhost:25055/service=sample.com/services/eim/v1/rest/version=1702.0/envContext=TEST/routeOffer=DEFAULT/subContext=/enterpriseConnection/getEnterpriseConnectionDetails/v1?dme2.password=fake&dme2.username=user@sample.com&dme2.allowhttpcode=true";
- DME2 dme = new DME2("user@sample.com", "fake", "TEST", "DEFAULT", new String[] { "http://localhost:25055" }, "common");
- String constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(instarUrl, constructedUrl);
- }
-
- @Test
- public void createInstarUrlNoSubContext() {
- String instarUrl = "http://localhost:25055/service=sample.com/services/eim/v1/rest/version=1702.0/envContext=TEST/routeOffer=DEFAULT?dme2.password=fake&dme2.username=user@sample.com&dme2.allowhttpcode=true";
- DME2 dme = new DME2("user@sample.com", "fake", "TEST", "DEFAULT", new String[] { "http://localhost:25055" }, "common");
- Map<String, String> parameters = new HashMap<String, String>();
- String constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", parameters.get(null));
- assertEquals(instarUrl, constructedUrl);
- }
-
- @Test
- public void testRoundRobin() {
- String[] proxyHostNames = new String[] { "http://one:25055", "http://two:25055", "http://three:25055" };
- String urlSuffix = "/service=sample.com/services/eim/v1/rest/version=1702.0/envContext=TEST/routeOffer=DEFAULT/subContext=/enterpriseConnection/getEnterpriseConnectionDetails/v1?dme2.password=fake&dme2.username=user@sample.com&dme2.allowhttpcode=true";
- DME2 dme = new DME2("user@sample.com", "fake", "TEST", "DEFAULT", proxyHostNames, "common");
- String constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(proxyHostNames[0] + urlSuffix, constructedUrl);
- constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(proxyHostNames[1] + urlSuffix, constructedUrl);
- constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(proxyHostNames[2] + urlSuffix, constructedUrl);
- constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(proxyHostNames[0] + urlSuffix, constructedUrl);
- constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(proxyHostNames[1] + urlSuffix, constructedUrl);
- constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(proxyHostNames[2] + urlSuffix, constructedUrl);
- constructedUrl = dme.constructUrl("sample.com/services/eim/v1/rest", "1702.0", "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
- assertEquals(proxyHostNames[0] + urlSuffix, constructedUrl);
- }
-
- @Test
- public void createDme2EndtoEnd() {
- Dme2PropertiesProvider provider =
- new Dme2PropertiesProvider("src/test/resources/dme2.e2e.properties");
- DME2 dme2 = new DME2(provider);
- assertEquals("user@sample.com", dme2.aafUserName);
- assertEquals("fake", dme2.aafPassword);
- assertEquals("UAT", dme2.envContext);
- assertEquals("UAT", dme2.routeOffer);
- Assert.assertArrayEquals("http://sample.com:25055,http://sample.com:25055".split(","), dme2.proxyUrls);
- assertEquals("1702.0", dme2.commonServiceVersion);
- assertEquals(null, dme2.partner);
-
- String constructedUrl = dme2.constructUrl("sample.com/restservices/instar/v1/assetSearch", null, "/mySubContext");
- assertNotNull(constructedUrl);
- System.out.println(constructedUrl);
- }
-
- @Test
- public void createDme2Prod() {
- Dme2PropertiesProvider provider =
- new Dme2PropertiesProvider("src/test/resources/dme2.prod.properties");
- DME2 dme2 = new DME2(provider);
- assertEquals("user@sample.com", dme2.aafUserName);
- assertEquals("fake", dme2.aafPassword);
- assertEquals("PROD", dme2.envContext);
- assertEquals("", dme2.routeOffer);
- Assert.assertArrayEquals("http://sample.com:25055,http://sample.com:25055".split(","), dme2.proxyUrls);
- assertEquals("1.0", dme2.commonServiceVersion);
- assertEquals("LPP_PROD", dme2.partner);
-
- String constructedUrl = dme2.constructUrl("sample.com/restservices/instar/v1/assetSearch", null, "/mySubContext");
- assertNotNull(constructedUrl);
- System.out.println(constructedUrl);
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.slipluginutils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class Dme2Test {
+ public Properties makesProperties(String aafUserName, String aafPassword, String envContext, String routeOffer,
+ String proxyUrls, String commonServiceVersion) {
+ Properties props = new Properties();
+ props.put(DME2.AAF_USERNAME_KEY, aafUserName);
+ props.put(DME2.AAF_PASSWORD_KEY, aafPassword);
+ props.put(DME2.ENV_CONTEXT_KEY, envContext);
+ props.put(DME2.ROUTE_OFFER_KEY, routeOffer);
+ props.put(DME2.PROXY_URL_KEY, proxyUrls);
+ props.put(DME2.COMMON_SERVICE_VERSION_KEY, commonServiceVersion);
+ return props;
+ }
+
+ @Test
+ public void createUrl() {
+ String instarUrl =
+ "http://localhost:25055/service=sample.com/services/eim/v1/rest/version=1702.0/envContext=TEST/routeOffer=DEFAULT/subContext=/enterpriseConnection/getEnterpriseConnectionDetails/v1?dme2.password=fake&dme2.username=user@sample.com&dme2.allowhttpcode=true";
+ Properties props =
+ makesProperties("user@sample.com", "fake", "TEST", "DEFAULT", "http://localhost:25055", "common");
+ DME2 dme = new DME2(props);
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(DME2.SERVICE_KEY, "sample.com/services/eim/v1/rest");
+ parameters.put(DME2.VERSION_KEY, "1702.0");
+ parameters.put(DME2.SUBCONTEXT_KEY, "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
+ parameters.put(DME2.OUTPUT_PATH_KEY, "tmp.test");
+
+ String constructedUrl = dme.constructUrl(parameters);
+ assertEquals(instarUrl, constructedUrl);
+ }
+
+ @Test
+ public void createUrlNoSubContext() {
+ String instarUrl =
+ "http://localhost:25055/service=sample.com/services/eim/v1/rest/version=1702.0/envContext=TEST/routeOffer=DEFAULT?dme2.password=fake&dme2.username=user@sample.com&dme2.allowhttpcode=true";
+ Properties props =
+ makesProperties("user@sample.com", "fake", "TEST", "DEFAULT", "http://localhost:25055", "common");
+ DME2 dme = new DME2(props);
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(DME2.SERVICE_KEY, "sample.com/services/eim/v1/rest");
+ parameters.put(DME2.VERSION_KEY, "1702.0");
+ parameters.put(DME2.SUBCONTEXT_KEY, null);
+ String constructedUrl = dme.constructUrl(parameters);
+ assertEquals(instarUrl, constructedUrl);
+ }
+
+ @Test
+ public void testRoundRobin() {
+ String[] proxyHostNames = new String[] {"http://one:25055", "http://two:25055", "http://three:25055"};
+ String proxyHostNameString = proxyHostNames[0] + "," + proxyHostNames[1] + "," + proxyHostNames[2];
+
+ String urlSuffix =
+ "/service=sample.com/services/eim/v1/rest/version=1702.0/envContext=TEST/routeOffer=DEFAULT/subContext=/enterpriseConnection/getEnterpriseConnectionDetails/v1?dme2.password=fake&dme2.username=user@sample.com&dme2.allowhttpcode=true";
+ Properties props = makesProperties("user@sample.com", "fake", "TEST", "DEFAULT", proxyHostNameString, "common");
+ DME2 dme = new DME2(props);
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(DME2.SERVICE_KEY, "sample.com/services/eim/v1/rest");
+ parameters.put(DME2.VERSION_KEY, "1702.0");
+ parameters.put(DME2.SUBCONTEXT_KEY, "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
+ String constructedUrl = dme.constructUrl(parameters);
+ assertEquals(proxyHostNames[0] + urlSuffix, constructedUrl);
+ constructedUrl = dme.constructUrl(parameters);
+ assertEquals(proxyHostNames[1] + urlSuffix, constructedUrl);
+ constructedUrl = dme.constructUrl(parameters);
+ assertEquals(proxyHostNames[2] + urlSuffix, constructedUrl);
+ constructedUrl = dme.constructUrl(parameters);
+ assertEquals(proxyHostNames[0] + urlSuffix, constructedUrl);
+ constructedUrl = dme.constructUrl(parameters);
+ assertEquals(proxyHostNames[1] + urlSuffix, constructedUrl);
+ constructedUrl = dme.constructUrl(parameters);
+ assertEquals(proxyHostNames[2] + urlSuffix, constructedUrl);
+ constructedUrl = dme.constructUrl(parameters);
+ assertEquals(proxyHostNames[0] + urlSuffix, constructedUrl);
+ }
+
+ @Test
+ public void createDme2EndtoEnd() throws FileNotFoundException, IOException {
+ Properties props = new Properties();
+ props.load(new FileInputStream("src/test/resources/dme2.e2e.properties"));
+ DME2 dme2 = new DME2(props);
+ assertEquals("user@sample.com", dme2.aafUserName);
+ assertEquals("fake", dme2.aafPassword);
+ assertEquals("UAT", dme2.envContext);
+ assertEquals("UAT", dme2.routeOffer);
+ Assert.assertArrayEquals(
+ "http://sample.com:25055,http://sample.com:25055".split(DME2.PROXY_URLS_VALUE_SEPARATOR),
+ dme2.proxyUrls);
+ assertEquals("1702.0", dme2.commonServiceVersion);
+ assertEquals(null, dme2.partner);
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(DME2.SERVICE_KEY, "sample.com/restservices/instar/v1/assetSearch");
+ parameters.put(DME2.VERSION_KEY, null);
+ parameters.put(DME2.SUBCONTEXT_KEY, "/mySubContext");
+ String constructedUrl = dme2.constructUrl(parameters);
+ assertNotNull(constructedUrl);
+ }
+
+ @Test
+ public void createDme2Prod() throws FileNotFoundException, IOException {
+ Properties props = new Properties();
+ props.load(new FileInputStream("src/test/resources/dme2.prod.properties"));
+ DME2 dme2 = new DME2(props);
+ assertEquals("user@sample.com", dme2.aafUserName);
+ assertEquals("fake", dme2.aafPassword);
+ assertEquals("PROD", dme2.envContext);
+ assertEquals(null, dme2.routeOffer);
+ Assert.assertArrayEquals(
+ "http://sample.com:25055,http://sample.com:25055".split(DME2.PROXY_URLS_VALUE_SEPARATOR),
+ dme2.proxyUrls);
+ assertEquals("1.0", dme2.commonServiceVersion);
+ assertEquals("LPP_PROD", dme2.partner);
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(DME2.SERVICE_KEY, "sample.com/services/eim/v1/rest");
+ parameters.put(DME2.VERSION_KEY, "1702.0");
+ parameters.put(DME2.SUBCONTEXT_KEY, "/enterpriseConnection/getEnterpriseConnectionDetails/v1");
+ String constructedUrl = dme2.constructUrl(parameters);
+ assertNotNull(constructedUrl);
+ }
+
+ @Test
+ public void blankProperties() throws Exception {
+ Properties props = new Properties();
+ DME2 dme2 = new DME2(props);
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(DME2.SERVICE_KEY, "easyService");
+ parameters.put(DME2.VERSION_KEY, "3");
+ parameters.put(DME2.SUBCONTEXT_KEY, "/sub");
+ assertEquals(
+ "http://localhost:5000/service=easyService/version=3/envContext=null/routeOffer=null/subContext=/sub?dme2.password=null&dme2.username=null&dme2.allowhttpcode=true",
+ dme2.constructUrl(parameters));
+ }
+
+ @Test
+ public void optionalParameters() {
+ String instarUrl =
+ "http://localhost:25055/service=serv/version=4/envContext=TEST/routeOffer=DEFAULT/subContext=/sub?dme2.password=fake&dme2.username=user@sample.com&dme2.allowhttpcode=true&test=123";
+ Properties props =
+ makesProperties("user@sample.com", "fake", "TEST", "DEFAULT", "http://localhost:25055", "common");
+ DME2 dme = new DME2(props);
+ Map<String, String> parameters = new HashMap<String, String>();
+ parameters.put(DME2.SERVICE_KEY, "serv");
+ parameters.put(DME2.VERSION_KEY, "4");
+ parameters.put(DME2.SUBCONTEXT_KEY, "/sub");
+ parameters.put("test", "123");
+
+ String constructedUrl = dme.constructUrl(parameters);
+ assertEquals(instarUrl, constructedUrl);
+ }
+
+}