aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main
diff options
context:
space:
mode:
authorTamasBakai <tamas.bakai@est.tech>2019-03-26 09:20:16 +0000
committerTamasBakai <tamas.bakai@est.tech>2019-03-26 09:20:16 +0000
commitbab325bf8248fd9033c828981b22942c2098b48a (patch)
tree7e91a663290b7ff87fb6d8d7eb722ba63c9e17d7 /test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main
parentc25ab4f11ff8944142229ba92d514f2ae58ec966 (diff)
Mass-pnf-sim URL handling improvements
Change-Id: Ic10551cb0cd1f875ad6a1cec3d73e1cfcb35d00e Issue-ID: DCAEGEN2-1225 Signed-off-by: TamasBakai <tamas.bakai@est.tech>
Diffstat (limited to 'test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main')
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java13
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java52
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java18
3 files changed, 48 insertions, 35 deletions
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java
index 4b293e897..15c687e2c 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java
@@ -7,11 +7,6 @@ import java.io.File;
public class ConfigurationProvider {
static PnfSimConfig conf = null;
- String IpVes = null;
- String IpSftp = null;
- String IpFtps = null;
- String IpPnfsim = null;
-
public static PnfSimConfig getConfigInstance() {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
@@ -19,10 +14,10 @@ public class ConfigurationProvider {
File file = new File("./config/config.yml");
conf = mapper.readValue(file, PnfSimConfig.class);
- System.out.println("Ves IP: " + conf.getVesip());
- System.out.println("SFTP IP: " + conf.getIpsftp());
- System.out.println("FTPS IP: " + conf.getIpftps());
- System.out.println("FTPS IP: " + conf.getIppnfsim());
+ System.out.println("Ves URL: " + conf.getUrlves());
+ System.out.println("SFTP URL: " + conf.getUrlsftp());
+ System.out.println("FTPS URL: " + conf.getUrlftps());
+ System.out.println("PNF sim IP: " + conf.getIppnfsim());
} catch (Exception e) {
e.printStackTrace();
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java
index 4931b5759..89f59a391 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/PnfSimConfig.java
@@ -1,49 +1,59 @@
package org.onap.pnfsimulator;
public class PnfSimConfig {
- private String vesip;
- private String ipftps;
- private String ipsftp;
+ private String urlves;
+ private String urlftps;
+ private String urlsftp;
private String ippnfsim;
+ private String defaultfileserver;
- public String getVesip() {
- return vesip;
+ public String getDefaultfileserver() {
+ return defaultfileserver;
}
- public void setVesip(String vesip) {
- this.vesip = vesip;
+ public void setDefaultfileserver(String defaultfileserver) {
+ this.defaultfileserver = defaultfileserver;
}
- public String getIpftps() {
- return ipftps;
+
+ public String getUrlves() {
+ return urlves;
}
- public void setIpftps(String ipftps) {
- this.ipftps = ipftps;
+ public void setUrlves(String urlves) {
+ this.urlves = urlves;
}
- public String getIpsftp() {
- return ipsftp;
+ public String getUrlftps() {
+ return urlftps;
}
- public void setIpsftp(String ipsftp) {
- this.ipsftp = ipsftp;
+ public void setUrlftps(String urlftps) {
+ this.urlftps = urlftps;
}
- public void setIppnfsim(String ippnfsim) {
- this.ippnfsim = ippnfsim;
+ public String getUrlsftp() {
+ return urlsftp;
}
- @Override
- public String toString() {
- return "PnfSimConfig [vesip=" + vesip + ", ipftps=" + ipftps + ", ippnfsim=" + ippnfsim + ", ipsftp=" + ipsftp
- + "]";
+ public void setUrlsftp(String urlsftp) {
+ this.urlsftp = urlsftp;
+ }
+
+ public void setIppnfsim(String ippnfsim) {
+ this.ippnfsim = ippnfsim;
}
public String getIppnfsim() {
return ippnfsim;
}
+ @Override
+ public String toString() {
+ return "PnfSimConfig [vesip=" + urlves + ", urlftps=" + urlftps + ", ippnfsim=" + ippnfsim + ", urlsftp="
+ + urlsftp + "]";
+ }
+
}
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
index cb58e3c7a..54af2b9a0 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/simulator/SimulatorFactory.java
@@ -53,18 +53,26 @@ public class SimulatorFactory {
Optional<JSONObject> pnfRegistrationParams, Optional<JSONObject> notificationParams)
throws ProcessingException, IOException, ValidationException {
PnfSimConfig configuration = ConfigurationProvider.getConfigInstance();
- String xnfUrl = "sftp://onap:pano@" + configuration.getIpsftp() + "/";
- String vesUrl = configuration.getVesip() + "/eventListener/v7";
+
+ String xnfUrl = null;
+
+ if (configuration.getDefaultfileserver().equals("sftp")) {
+ xnfUrl = configuration.getUrlsftp() + "/";
+ } else if (configuration.getDefaultfileserver().equals("ftps")) {
+ xnfUrl = configuration.getUrlftps() + "/";
+ }
+
+ String urlVes = configuration.getUrlves();
Duration duration = Duration.ofSeconds(parseInt(simulatorParams.getString(TEST_DURATION)));
Duration interval = Duration.ofSeconds(parseInt(simulatorParams.getString(MESSAGE_INTERVAL)));
List<String> fileList = FileProvider.getFiles();
- JSONObject messageBody = messageProvider
- .createMessage(commonEventHeaderParams, pnfRegistrationParams, notificationParams, fileList, xnfUrl);
+ JSONObject messageBody = messageProvider.createMessage(commonEventHeaderParams, pnfRegistrationParams,
+ notificationParams, fileList, xnfUrl);
validator.validate(messageBody.toString(), DEFAULT_OUTPUT_SCHEMA_PATH);
- return Simulator.builder().withVesUrl(vesUrl).withDuration(duration).withInterval(interval)
+ return Simulator.builder().withVesUrl(urlVes).withDuration(duration).withInterval(interval)
.withMessageBody(messageBody).build();
}