From 13cec1b8eb3501b0f9c69782bcda6bf9d08da261 Mon Sep 17 00:00:00 2001 From: xdurvak Date: Mon, 24 Jul 2017 15:37:44 +0530 Subject: [PATCH] uplifted shared version to 0.3.3 to support versioning functionality (#67) --- CHANGELOG.md | 1 + build.gradle | 28 +++++++------- cli/build.gradle | 6 +-- .../remrem/generate/EiffelSemanticsCli.java | 2 +- .../remrem/generate/cli/CLIOptions.java | 8 ++-- service/build.gradle | 6 +-- .../controller/RemremGenerateController.java | 13 +++++++ .../controller/VersionsController.java | 37 ------------------- 8 files changed, 39 insertions(+), 62 deletions(-) delete mode 100644 service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/VersionsController.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a85d502..9340d399 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.8.1 - Added copyright headers to the source code. +- Uplifted remrem-shared version to 0.3.3 to get the versions of generate and all loaded protocols. ## 0.8.0 - Updated remrem-shared version to 0.3.2 to support base64 encryption functionality for Ldap manager password. diff --git a/build.gradle b/build.gradle index 7c10bb05..06ef950f 100644 --- a/build.gradle +++ b/build.gradle @@ -59,19 +59,19 @@ subprojects { maven { url "https://jitpack.io" } } - dependencies { - //Injectable Message Library and its Implementation - compile ('com.github.Ericsson:eiffel-remrem-shared:0.3.2') - compile ('com.github.Ericsson:eiffel-remrem-semantics:0.2.3') - compile ('com.github.Ericsson:eiffel-remrem-protocol-interface:0.0.1') - - //Authentication - compile("org.springframework.boot:spring-boot-starter-security:$sprintBootVersion") - compile("org.springframework.security:spring-security-ldap:4.1.3.RELEASE") - compile("org.apache.directory.server:apacheds-server-jndi:1.5.5") - // Test framework - testCompile 'junit:junit:4.12' - testCompile 'org.assertj:assertj-core:3.4.1' - testCompile("org.springframework.boot:spring-boot-starter-test:$sprintBootVersion") + dependencies { + //Injectable Message Library and its Implementation + compile ('com.github.Ericsson:eiffel-remrem-shared:0.3.3') + compile ('com.github.Ericsson:eiffel-remrem-semantics:0.2.5') + compile ('com.github.Ericsson:eiffel-remrem-protocol-interface:0.0.1') + + //Authentication + compile("org.springframework.boot:spring-boot-starter-security:$sprintBootVersion") + compile("org.springframework.security:spring-security-ldap:4.1.3.RELEASE") + compile("org.apache.directory.server:apacheds-server-jndi:1.5.5") + // Test framework + testCompile 'junit:junit:4.12' + testCompile 'org.assertj:assertj-core:3.4.1' + testCompile("org.springframework.boot:spring-boot-starter-test:$sprintBootVersion") } } \ No newline at end of file diff --git a/cli/build.gradle b/cli/build.gradle index 6fe5f3e2..690c7d1f 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -82,9 +82,9 @@ apply plugin: 'eclipse' jar{ baseName = 'generate-cli' manifest { - attributes( - 'Main-Class': 'com.ericsson.eiffel.remrem.generate.cli.CLI' - ) + attributes('Main-Class': 'com.ericsson.eiffel.remrem.generate.cli.CLI') + attributes('remremVersionKey': 'serviceVersion') + attributes('serviceVersion': version) } } diff --git a/cli/src/integration-test/java/com/ericsson/eiffel/remrem/generate/EiffelSemanticsCli.java b/cli/src/integration-test/java/com/ericsson/eiffel/remrem/generate/EiffelSemanticsCli.java index a5626fd7..dbeae65a 100644 --- a/cli/src/integration-test/java/com/ericsson/eiffel/remrem/generate/EiffelSemanticsCli.java +++ b/cli/src/integration-test/java/com/ericsson/eiffel/remrem/generate/EiffelSemanticsCli.java @@ -81,7 +81,7 @@ public void testWrongMessageTypeFail() throws Exception { CLIOptions.parse(args); cli.main(args); String message = bytes.toString(); - boolean conditionTrue = message.contains("Unknown message type requested"); + boolean conditionTrue = message.contains("Unknown event type requested"); assertTrue(conditionTrue); } diff --git a/cli/src/main/java/com/ericsson/eiffel/remrem/generate/cli/CLIOptions.java b/cli/src/main/java/com/ericsson/eiffel/remrem/generate/cli/CLIOptions.java index 2544abc4..133f563e 100644 --- a/cli/src/main/java/com/ericsson/eiffel/remrem/generate/cli/CLIOptions.java +++ b/cli/src/main/java/com/ericsson/eiffel/remrem/generate/cli/CLIOptions.java @@ -77,7 +77,7 @@ public static Options createCLIOptions() { contentGroup.addOption(new Option("json", "json_content", true, "json content")); options.addOptionGroup(contentGroup); - options.addOption("lv", "list_versions", false, "list the version and all loaded protocols"); + options.addOption("v", "list_versions", false, "lists the versions of generate and all loaded protocols"); return options; } @@ -125,7 +125,7 @@ public static void afterParseChecks() throws MissingOptionException{ if (commandLine.hasOption("h")) { System.out.println("You passed help flag."); help(0); - } else if (commandLine.hasOption("lv")) { + } else if (commandLine.hasOption("v")) { printVersions(); } else { checkRequiredOptions(); @@ -133,11 +133,11 @@ public static void afterParseChecks() throws MissingOptionException{ } /** - * Lists the version and all loaded protocols + * Lists the versions of generate and all loaded protocols */ @SuppressWarnings({ "rawtypes", "unchecked" }) private static void printVersions() { - Map versions = VersionService.getMessagingVersions(); + Map versions = new VersionService().getMessagingVersions(); Map endpointVersions = (Map) versions.get("endpointVersions"); Map serviceVersion = (Map) versions.get("serviceVersion"); diff --git a/service/build.gradle b/service/build.gradle index f214dfe4..c669f382 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -25,9 +25,9 @@ apply plugin: 'war' war { baseName = 'generate-service' manifest { - attributes( - 'Main-Class': 'com.ericsson.eiffel.remrem.generate.App' - ) + attributes('Main-Class': 'com.ericsson.eiffel.remrem.generate.App') + attributes('remremVersionKey': 'serviceVersion') + attributes('serviceVersion': version) } } diff --git a/service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/RemremGenerateController.java b/service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/RemremGenerateController.java index ba2769dd..0cb0305a 100644 --- a/service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/RemremGenerateController.java +++ b/service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/RemremGenerateController.java @@ -15,6 +15,7 @@ package com.ericsson.eiffel.remrem.generate.controller; import java.util.List; +import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -28,6 +29,7 @@ import com.ericsson.eiffel.remrem.generate.constants.RemremGenerateServiceConstants; import com.ericsson.eiffel.remrem.protocol.MsgService; +import com.ericsson.eiffel.remrem.shared.VersionService; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser;; @@ -76,6 +78,17 @@ public ResponseEntity generate(@PathVariable String mp, @RequestParam("msgTyp return new ResponseEntity<>(null,HttpStatus.INTERNAL_SERVER_ERROR); } } + + /** + * this method is used to display the versions of generate and all loaded protocols. + * + * @return this method returns a json with version details. + */ + @RequestMapping(value = "/versions", method = RequestMethod.GET) + public JsonElement getVersions() { + Map> versions = new VersionService().getMessagingVersions(); + return parser.parse(versions.toString()); + } private MsgService getMessageService(String messageProtocol) { diff --git a/service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/VersionsController.java b/service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/VersionsController.java deleted file mode 100644 index 586c637f..00000000 --- a/service/src/main/java/com/ericsson/eiffel/remrem/generate/controller/VersionsController.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright 2017 Ericsson AB. - For a full list of individual contributors, please see the commit history. - 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 - - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -package com.ericsson.eiffel.remrem.generate.controller; - -import java.util.Map; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.ericsson.eiffel.remrem.shared.VersionService; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; - -@RestController @RequestMapping("/versions") -public class VersionsController { - - JsonParser parser = new JsonParser(); - - @RequestMapping(value = "", method = RequestMethod.POST) - public JsonElement getVersions() { - Map versions = VersionService.getMessagingVersions(); - return parser.parse(versions.toString()); - } -}