diff options
author | Gautam Shah <gautams@amdocs.com> | 2018-06-05 18:50:13 +0530 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-06-06 06:27:18 +0000 |
commit | 719e3bb7d4f6b31c178abaeff9b8124ce7703662 (patch) | |
tree | db69388be45dfb58c781f78c9907ae1b4ca2d9ed /openecomp-be/tools/artifact-copy-plugin/src/main | |
parent | 16ecda5c6ebb673636e7c74e5501f9f2c8ae00b0 (diff) |
Onboarding backend build optimization.
Enhancing Test RUN/NO-RUN Logic, adding identifiers for local build state repo
Change-Id: Ie0a541f216c16ddc40605111981d7a2fa045c39d
Issue-ID: SDC-1189
Signed-off-by: GAUTAMS <gautams@amdocs.com>
Diffstat (limited to 'openecomp-be/tools/artifact-copy-plugin/src/main')
2 files changed, 10 insertions, 2 deletions
diff --git a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java index f51a8aae60..f5bbbd605a 100644 --- a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java +++ b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/ArtifactHelper.java @@ -49,6 +49,7 @@ public class ArtifactHelper { private static File unicornMetaLocation = null; private File tempLocation = Paths.get(System.getProperties().getProperty("java.io.tmpdir")).toFile(); private static int snapshotBuildNumber = 0; + private static final String HYPHEN = "-"; void init(String terminalModuleCoordinate) { setUnicornMetaLocation(getUnicornRootFile(unicornRoot.substring(0, unicornRoot.indexOf('/')), project)); @@ -141,11 +142,13 @@ public class ArtifactHelper { try (InputStream is = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(is)) { dataStore = HashMap.class.cast(ois.readObject()); dataStore.put("shutdownTime", (System.currentTimeMillis() / 1000) * 1000 + snapshotBuildNumber); + dataStore.put("version", project.getVersion()); } try (OutputStream os = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(os)) { oos.writeObject(dataStore); } - Files.copy(file.toPath(), Paths.get(tempLocation.getAbsolutePath(), file.getName()), + Files.copy(file.toPath(), + Paths.get(tempLocation.getAbsolutePath(), file.getName() + HYPHEN + project.getVersion()), StandardCopyOption.REPLACE_EXISTING); } } diff --git a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java index 6fa9b0e365..9585057524 100644 --- a/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java +++ b/openecomp-be/tools/artifact-copy-plugin/src/main/java/org/openecomp/sdc/onboarding/util/InitializationHelperMojo.java @@ -67,6 +67,11 @@ public class InitializationHelperMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { if (System.getProperties().containsKey(UNICORN_INITIALIZED)) { + try { + artifactHelper.shutDown(project); + } catch (IOException | ClassNotFoundException e) { + throw new MojoExecutionException("Unexpected Error Occured during shutdown activities", e); + } return; } artifactHelper.init(groupId + ":" + artifactId); @@ -105,7 +110,7 @@ public class InitializationHelperMojo extends AbstractMojo { byte[] data = fetchContents(repo.getUrl(), artifactId, timestamp + "-" + buildNumber); artifactHelper.store(artifactId, data); getLog().info(artifactId + " Version to be copied is " + timestamp + "-" + buildNumber); - artifactHelper.setSnapshotBuildNumber(Integer.parseInt(buildNumber)); + ArtifactHelper.setSnapshotBuildNumber(Integer.parseInt(buildNumber)); return timestamp + "-" + buildNumber; } } catch (IOException e) { |