summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}
}