summaryrefslogtreecommitdiffstats
path: root/sdnr/wt
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2020-02-27 15:24:18 -0500
committerSingal, Kapil (ks220y) <ks220y@att.com>2020-02-27 16:47:52 -0500
commit6b17990c9bdffbf32c901d8bf56cfbd8796c0837 (patch)
tree52eb126d57c9456f3bafce535ad08017c0635f93 /sdnr/wt
parentee75b19ee79f49b28a3137b6dcfdf02d6120f3de (diff)
Refactoring data-provider:provider generateDTOs
Fixing EsInit.script file creation Change-Id: I615114e617bdabbb876a66610caa2665b17f0a71 Issue-ID: SDNC-1085 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Diffstat (limited to 'sdnr/wt')
-rw-r--r--sdnr/wt/data-provider/provider/pom.xml6
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java16
2 files changed, 14 insertions, 8 deletions
diff --git a/sdnr/wt/data-provider/provider/pom.xml b/sdnr/wt/data-provider/provider/pom.xml
index 3f72ce1a7..d834dc2f5 100644
--- a/sdnr/wt/data-provider/provider/pom.xml
+++ b/sdnr/wt/data-provider/provider/pom.xml
@@ -61,7 +61,7 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-data-provider-setup</artifactId>
<version>${project.version}</version>
@@ -143,10 +143,10 @@
<goal>exec</goal>
</goals>
<configuration>
- <executable>java</executable>
+ <executable>java</executable>
<arguments>
<argument>-jar</argument>
- <argument>${basedir}/../../data-provider/setup/target/sdnr-dmt.jar</argument>
+ <argument>${basedir}/../setup/target/sdnr-dmt.jar</argument>
<argument>-c</argument>
<argument>pluginfile</argument>
<argument>-of</argument>
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java
index a63f8d4c1..e923b2728 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java
@@ -5,6 +5,8 @@
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
* All rights reserved.
* ================================================================================
+ * Update Copyright (C) 2020 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
@@ -23,7 +25,6 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data;
import java.io.File;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
@@ -44,15 +45,20 @@ public class MavenDatabasePluginInitFile {
"{\"type\":\"custom\",\"tokenizer\":\"whitespace\"}}}}";
public static void create(Release release, String filename) throws IOException {
-
+
ReleaseInformation ri = ReleaseInformation.getInstance(release);
Set<ComponentName> comps=ri.getComponents();
- List<String> lines = new ArrayList<String>();
+ List<String> lines = new ArrayList<>();
for(ComponentName c:comps) {
lines.add(String.format("PUT:%s/:{"+settings+","+mappings+"}",ri.getIndex(c),shards,replicas,ri.getDatabaseMapping(c)));
lines.add(String.format("PUT:%s/_alias/%s/:{}", ri.getIndex(c),ri.getAlias(c)));
}
- Files.write(new File(filename).toPath(),lines,StandardCharsets.UTF_8);
-
+
+ File filePath = new File(filename);
+ if (filePath.getParentFile() != null && !filePath.getParentFile().exists()){
+ //Crate Directory if missing
+ filePath.getParentFile().mkdirs();
+ }
+ Files.write(filePath.toPath(), lines);
}
}