From 6b17990c9bdffbf32c901d8bf56cfbd8796c0837 Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Thu, 27 Feb 2020 15:24:18 -0500 Subject: Refactoring data-provider:provider generateDTOs Fixing EsInit.script file creation Change-Id: I615114e617bdabbb876a66610caa2665b17f0a71 Issue-ID: SDNC-1085 Signed-off-by: Singal, Kapil (ks220y) --- sdnr/wt/data-provider/provider/pom.xml | 6 +++--- .../setup/data/MavenDatabasePluginInitFile.java | 16 +++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'sdnr') 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 @@ mockito-core test - + ${project.groupId} sdnr-wt-data-provider-setup ${project.version} @@ -143,10 +143,10 @@ exec - java + java -jar - ${basedir}/../../data-provider/setup/target/sdnr-dmt.jar + ${basedir}/../setup/target/sdnr-dmt.jar -c pluginfile -of 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 comps=ri.getComponents(); - List lines = new ArrayList(); + List 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); } } -- cgit 1.2.3-korg