diff --git a/CHANGELOG.md b/CHANGELOG.md index 6265fc80..99175566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.1 +- Fix for Invalid exchange return success. Added a createExchangeIfNotExisting property to create an exchange. +- For CLI Added a option create_exchange or ce to create Exchange. +- Upgraded eiffel-remrem-semantics version from 2.0.3 to 2.0.4. + ## 2.0.0 - Upgraded eiffel-remrem-semantics version from 1.0.1 to 2.0.3 - Modified test cases as per agen version and tested with proper data diff --git a/pom.xml b/pom.xml index 2c07d626..fad1cd5a 100644 --- a/pom.xml +++ b/pom.xml @@ -9,9 +9,9 @@ 2.0.0 - 2.0.0 + 2.0.1 2.0.0 - 2.0.3 + 2.0.4 eiffel-remrem-publish ${eiffel-remrem-publish.version} diff --git a/publish-cli/pom.xml b/publish-cli/pom.xml index 4c7ad8a2..3b1f3615 100644 --- a/publish-cli/pom.xml +++ b/publish-cli/pom.xml @@ -116,6 +116,18 @@ spring-boot-starter-test test + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.version} + test + diff --git a/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CLI.java b/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CLI.java index a94ad308..6ba8263b 100644 --- a/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CLI.java +++ b/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CLI.java @@ -38,6 +38,7 @@ import com.ericsson.eiffel.remrem.publish.service.MessageService; import com.ericsson.eiffel.remrem.publish.service.PublishResultItem; import com.ericsson.eiffel.remrem.publish.service.SendResult; +import com.ericsson.eiffel.remrem.publish.exception.RemRemPublishException; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; @@ -58,53 +59,56 @@ @SpringBootApplication @ComponentScan(basePackages = "com.ericsson.eiffel.remrem") public class CLI implements CommandLineRunner{ - - @Autowired @Qualifier("messageServiceRMQImpl") MessageService messageService; - @Autowired + + @Autowired + @Qualifier("messageServiceRMQImpl") + MessageService messageService; + + @Autowired private MsgService[] msgServices; + @Autowired RMQHelper rmqHelper; - Logger log = (Logger) LoggerFactory.getLogger(CLI.class); - + + Logger log = (Logger) LoggerFactory.getLogger(CLI.class); + /** * Delegates actions depending on the passed arguments * @param commandLine command line arguments */ private void handleOptions() { - CommandLine commandLine = CliOptions.getCommandLine(); - if (commandLine.hasOption("h")) { - System.out.println("You passed help flag."); - CliOptions.help(0); - } else if (commandLine.hasOption("f")) { + CommandLine commandLine = CliOptions.getCommandLine(); + if (commandLine.hasOption("h")) { + System.out.println("You passed help flag."); + CliOptions.help(0); + } else if (commandLine.hasOption("f")) { String filePath = commandLine.getOptionValue("f"); handleContentFile(filePath); } else if (commandLine.hasOption("json")) { String content = getJsonString(commandLine); handleContent(content); } else { - System.out.println("Missing arguments, please review your arguments" + - " and check if any mandatory argument is missing"); - CliOptions.help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION); + System.out.println("Missing arguments, please review your arguments" + + " and check if any mandatory argument is missing"); + CliOptions.help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION); } } - + private String getJsonString(CommandLine commandLine) { - String jsonContent = commandLine.getOptionValue("json"); - - if (jsonContent.equals("-")) { - try { - InputStreamReader isReader = new InputStreamReader(System.in); - BufferedReader bufReader = new BufferedReader(isReader); - jsonContent = bufReader.readLine(); - } catch (Exception e) { - e.printStackTrace(); - CliOptions.exit(CLIExitCodes.READ_JSON_FROM_CONSOLE_FAILED); - } - - } - return jsonContent; + String jsonContent = commandLine.getOptionValue("json"); + if (jsonContent.equals("-")) { + try { + InputStreamReader isReader = new InputStreamReader(System.in); + BufferedReader bufReader = new BufferedReader(isReader); + jsonContent = bufReader.readLine(); + } catch (Exception e) { + e.printStackTrace(); + CliOptions.exit(CLIExitCodes.READ_JSON_FROM_CONSOLE_FAILED); + } + } + return jsonContent; } - + /** * Handle event from file * @param filePath the path of the file where the messages reside @@ -123,12 +127,13 @@ public void handleContentFile(String filePath) { CliOptions.exit(CLIExitCodes.HANDLE_CONTENT_FILE_COULD_NOT_READ_FAILED); } } - + /** * Handle event from file * @param filePath the path of the file where the messages reside */ public void handleContent(String content) { + String exchangeName = CliOptions.getCommandLine().getOptionValue("en"); try { String msgProtocol = CliOptions.getCommandLine().getOptionValue("mp"); MsgService msgService = PublishUtils.getMessageService(msgProtocol, msgServices); @@ -146,6 +151,13 @@ public void handleContent(String content) { } else { throw new Exception(); } + }catch (RemRemPublishException e) { + JsonArray errorResponse = new JsonArray(); + PublishResultItem result = new PublishResultItem(null, 404, + null,e.getMessage()); + errorResponse.add(result.toJsonObject()); + System.err.println(new GsonBuilder().setPrettyPrinting().create().toJson(errorResponse)); + CliOptions.exit(CLIExitCodes.HANDLE_CONTENT_FAILED); } catch (Exception e) { log.debug("Exception: ", e); System.err.println("Exception: " + e.getMessage()); @@ -153,22 +165,22 @@ public void handleContent(String content) { } } - @Override - public void run(String... args) throws Exception { - if (CliOptions.hasParsedOptions()) - handleOptions(); - boolean cliMode = Boolean.getBoolean(PropertiesConfig.CLI_MODE); + @Override + public void run(String... args) throws Exception { + if (CliOptions.hasParsedOptions()) + handleOptions(); + boolean cliMode = Boolean.getBoolean(PropertiesConfig.CLI_MODE); if (cliMode) - CliOptions.help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION); - } - - public static void main(String args[]) { - SpringApplication application = new SpringApplication(CLI.class); - application.addInitializers(new SpringLoggingInitializer()); - application.setBannerMode(Banner.Mode.OFF); - application.setLogStartupInfo(false); - application.setWebEnvironment(false); - CliOptions.parse(args); - application.run(args); - } + CliOptions.help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION); + } + + public static void main(String args[]) { + SpringApplication application = new SpringApplication(CLI.class); + application.addInitializers(new SpringLoggingInitializer()); + application.setBannerMode(Banner.Mode.OFF); + application.setLogStartupInfo(false); + application.setWebEnvironment(false); + CliOptions.parse(args); + application.run(args); + } } \ No newline at end of file diff --git a/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CliOptions.java b/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CliOptions.java index 07a7c00b..e4fbb913 100644 --- a/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CliOptions.java +++ b/publish-cli/src/main/java/com/ericsson/eiffel/remrem/publish/cli/CliOptions.java @@ -31,9 +31,9 @@ import com.ericsson.eiffel.remrem.shared.VersionService; public class CliOptions { - - static private Options options=null; - static private CommandLine commandLine; + + static private Options options=null; + static private CommandLine commandLine; //Used for testing purposes private static ArrayList testErrorCodes = new ArrayList<>(); @@ -42,28 +42,27 @@ public static ArrayList getErrorCodes() { return testErrorCodes; } - public static void addErrorCode(int errorCode) { - testErrorCodes.add(errorCode); - } + public static void addErrorCode(int errorCode) { + testErrorCodes.add(errorCode); + } - public static void cleanErrorCodes() { - testErrorCodes.clear(); - } + public static void cleanErrorCodes() { + testErrorCodes.clear(); + } private static OptionGroup contentGroup = null; - - public static CommandLine getCommandLine() { - return commandLine; - } - - public static Options createHelpOptions() { - Options hOptions = new Options(); - hOptions.addOption(createHelpOption()); - return hOptions; - } - - /** + public static CommandLine getCommandLine() { + return commandLine; + } + + public static Options createHelpOptions() { + Options hOptions = new Options(); + hOptions.addOption(createHelpOption()); + return hOptions; + } + + /** * Creates the options needed by command line interface * @return the options this CLI can handle */ @@ -73,6 +72,7 @@ public static void createCLIOptions() { options.addOption("d", "debug", false, "enable debug traces"); options.addOption("mb", "message_bus", true, "host of message bus to use"); options.addOption("en", "exchange_name", true, "exchange name"); + options.addOption("ce", "create_exchange", true, "option to denote if we need to create an exchange eg: -ce true or --create_exchange true"); options.addOption("np", "non_persistent", false, "remove persistence from message sending"); options.addOption("port", "port", true, "port to connect to message bus, default is 5672"); options.addOption("tls", "tls", true, "tls version, specify a valid tls version: '1', '1.1, '1.2' or 'default'. It is required for RabbitMq secured port."); @@ -82,60 +82,60 @@ public static void createCLIOptions() { options.addOption("v", "lists the versions of publish and all loaded protocols"); options.addOption("tag", "tag", true, "tag to be used in routing key"); options.addOption("rk", "routing_key", true, "routing key of the eiffel message. When provided routing key is not generated and the value provided is used."); + contentGroup = createContentGroup(); options.addOptionGroup(contentGroup); } - + private static Option createJsonOption() { - return new Option("json", "json_content", true, "event content in json string. The value can also be a dash(-) and the json will be read from the output of other programs if piped."); + return new Option("json", "json_content", true, "event content in json string. The value can also be a dash(-) and the json will be read from the output of other programs if piped."); } - + private static Option createFileOption() { - return new Option("f", "content_file", true, "event content file"); + return new Option("f", "content_file", true, "event content file"); } - + private static Option createHelpOption() { - return new Option("h", "help", false, "show help"); + return new Option("h", "help", false, "show help"); } - + private static OptionGroup createContentGroup() { - OptionGroup group = new OptionGroup(); - group.addOption(createFileOption()); - group.addOption(createJsonOption()); - return group; + OptionGroup group = new OptionGroup(); + group.addOption(createFileOption()); + group.addOption(createJsonOption()); + return group; } - - + /** * Parse the given arguments and act on them * @param args command line arguments * @return if the service should start or not */ public static void parse(String[] args) { - createCLIOptions(); - CommandLineParser parser = new DefaultParser(); - try { - commandLine = parser.parse(options, args); - afterParseChecks(); - handleMessageBusOptions(); - handleDebugOptions(); - } catch (Exception e) { - System.out.println(e.getMessage()); - help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION); - } - } - + createCLIOptions(); + CommandLineParser parser = new DefaultParser(); + try { + commandLine = parser.parse(options, args); + afterParseChecks(); + handleMessageBusOptions(); + handleDebugOptions(); + } catch (Exception e) { + System.out.println(e.getMessage()); + help(CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION); + } + } + public static void afterParseChecks() throws MissingOptionException { if (commandLine.hasOption("h")) { - System.out.println("You passed help flag."); - help(0); + System.out.println("You passed help flag."); + help(0); } else if (commandLine.hasOption("v")) { printVersions(); }else { checkRequiredOptions(); } } - + public static void checkRequiredOptions() throws MissingOptionException { OptionGroup[] groups = {contentGroup}; for(OptionGroup group : groups) { @@ -152,15 +152,15 @@ public static void checkRequiredOptions() throws MissingOptionException { } } } - + /** * Checks if any options that CLI can handle have been passed * @return true if any valid options have been - * passed as arguments otherwise false + * passed as arguments otherwise false */ public static boolean hasParsedOptions() { if (commandLine == null) - return false; + return false; Option[] existingOptions = commandLine.getOptions(); return existingOptions.length > 0; @@ -171,13 +171,13 @@ public static boolean hasParsedOptions() { * @param options the options to print usage help for */ public static void help(int errorCode) { - CliOptions.clearSystemProperties(); - // This prints out some help + CliOptions.clearSystemProperties(); + // This prints out some help HelpFormatter formater = new HelpFormatter(); formater.printHelp("java -jar", options); exit(errorCode); } - + /** * Sets the system properties with values passed for * message bus host and exchange name @@ -202,6 +202,12 @@ public static void handleMessageBusOptions() throws HandleMessageBusException { System.setProperty(key, port); } + if (commandLine.hasOption("ce")) { + String createExchange = commandLine.getOptionValue("ce"); + String key = PropertiesConfig.CREATE_EXCHANGE_IF_NOT_EXISTING; + System.setProperty(key, createExchange); + } + if (commandLine.hasOption("domain")) { String domain = commandLine.getOptionValue("domain"); String key = PropertiesConfig.DOMAIN_ID; @@ -218,12 +224,12 @@ public static void handleMessageBusOptions() throws HandleMessageBusException { throw new HandleMessageBusException("Specified TLS version is not valid! Specify a valid TLS version!"); } String key = PropertiesConfig.TLS; - System.setProperty(key, tls_ver); + System.setProperty(key, tls_ver); } String usePersistance = "true"; if (commandLine.hasOption("np")) { - usePersistance = "false"; + usePersistance = "false"; } String key = PropertiesConfig.USE_PERSISTENCE; System.setProperty(key, usePersistance); @@ -261,7 +267,7 @@ public static void clearSystemProperties() { key = PropertiesConfig.DOMAIN_ID; System.clearProperty(key); } - + /** * Wrapper to call system exit making class easier to test. * @param errorCode @@ -273,7 +279,7 @@ public static void exit(int errorCode) { else System.exit(errorCode); } - + /** * Lists the versions of publish and all loaded protocols */ diff --git a/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliOptionsUnitTests.java b/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliOptionsUnitTests.java index 3d1ad60d..06519736 100644 --- a/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliOptionsUnitTests.java +++ b/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliOptionsUnitTests.java @@ -29,8 +29,8 @@ public class CliOptionsUnitTests { private PrintStream console; private ByteArrayOutputStream bytes; - - @Before public void setUp() throws Exception { + + @Before public void setUp() throws Exception { String key = PropertiesConfig.TEST_MODE; System.setProperty(key, "true"); //Switch std out to another stream @@ -46,10 +46,10 @@ public void tearDown() { // reset error code since it is static CliOptions.cleanErrorCodes(); } - + @Test - public void testParseEmptyCLIOptionsFails() throws Exception { - String[] args = new String[0]; + public void testParseEmptyCLIOptionsFails() throws Exception { + String[] args = new String[0]; CliOptions.parse(args); int code = CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION; @@ -63,14 +63,14 @@ public void testHelpOptionOnlyWorks() throws Exception { assertTrue(CliOptions.getErrorCodes().contains(0)); assertTrue(CliOptions.getErrorCodes().size() == 1); } - + @Test public void testTlsOption() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-tls", "1"}; CliOptions.parse(args); assertTrue(CliOptions.getErrorCodes().isEmpty()); } - + @Test public void testTlsOptionFails() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-tlsa", "1.2"}; @@ -94,7 +94,15 @@ public void testMbOption() throws Exception { System.out.println(CliOptions.getErrorCodes()); assertTrue(CliOptions.getErrorCodes().isEmpty()); } - + + @Test + public void testCreateExchangeOption() throws Exception { + String[] args = {"-f", "/a/b/c/test.file", "test", "-ce", "false"}; + CliOptions.parse(args); + System.out.println(CliOptions.getErrorCodes()); + assertTrue(CliOptions.getErrorCodes().isEmpty()); + } + @Test public void testMbOptionFails() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-mbe", "MbInstance1"}; @@ -102,13 +110,13 @@ public void testMbOptionFails() throws Exception { int code = CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION; assertTrue(CliOptions.getErrorCodes().contains(code)); } - + public void testEnOption() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-en", "exchange_name1"}; CliOptions.parse(args); assertTrue(CliOptions.getErrorCodes().isEmpty()); } - + @Test public void testEnOptionFails() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-enf", "exchange_name1"}; @@ -116,13 +124,13 @@ public void testEnOptionFails() throws Exception { int code = CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION; assertTrue(CliOptions.getErrorCodes().contains(code)); } - + public void testNpOption() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-np", "non_persistent"}; CliOptions.parse(args); assertTrue(CliOptions.getErrorCodes().isEmpty()); } - + @Test public void testNpOptionFails() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-npf", "non_persistent"}; @@ -144,7 +152,7 @@ public void testPortOptionFails() throws Exception { int code = CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION; assertTrue(CliOptions.getErrorCodes().contains(code)); } - + public void testFOption() throws Exception { String[] args = {"-f", "/a/b/c/test.file", "test", "-port", "portA"}; CliOptions.parse(args); @@ -158,5 +166,4 @@ public void testFOptionFails() throws Exception { int code = CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION; assertTrue(CliOptions.getErrorCodes().contains(code)); } - } diff --git a/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliUnitTests.java b/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliUnitTests.java index 0a2accbb..c7a289dd 100644 --- a/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliUnitTests.java +++ b/publish-cli/src/test/java/com/ericsson/eiffel/remrem/publish/cli/CliUnitTests.java @@ -22,45 +22,68 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -//import org.mockito.Mock; -//import org.mockito.Mockito; +import java.util.ArrayList; +import java.io.File; +import java.util.List; + import org.mockito.MockitoAnnotations; import com.ericsson.eiffel.remrem.publish.cli.CLIExitCodes; import com.ericsson.eiffel.remrem.publish.cli.CLI; import com.ericsson.eiffel.remrem.publish.cli.CliOptions; import com.ericsson.eiffel.remrem.publish.config.PropertiesConfig; -//import com.ericsson.eiffel.remrem.shared.MsgService; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import com.ericsson.eiffel.remrem.protocol.MsgService; +import com.ericsson.eiffel.remrem.publish.exception.RemRemPublishException; +import com.ericsson.eiffel.remrem.publish.helper.PublishUtils; +import com.ericsson.eiffel.remrem.publish.helper.RMQHelper; +import com.ericsson.eiffel.remrem.publish.service.MessageService; +import com.ericsson.eiffel.remrem.publish.service.PublishResultItem; +import com.ericsson.eiffel.remrem.publish.service.SendResult; +import com.google.gson.JsonArray; +@RunWith(PowerMockRunner.class) +@PrepareForTest(PublishUtils.class) public class CliUnitTests { private PrintStream console; private ByteArrayOutputStream bytes; - -// @Mock -// private MsgService msgService; + @Mock + MsgService eiffelsemanticsMsgService; + + @Mock + MessageService messageService; + + @Mock + RMQHelper rmqHelper; + + @Mock + SendResult res; + + @Mock + PublishResultItem resultItem; + + @InjectMocks private CLI cli; - + @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); String key = PropertiesConfig.TEST_MODE; System.setProperty(key, "true"); - // Switch std out to another stream in case - // we need to check output - bytes = new ByteArrayOutputStream(); + + bytes = new ByteArrayOutputStream(); console = System.out; System.setOut(new PrintStream(bytes)); -// MsgService[] msgServices = {msgService}; -// cli = new CLI(msgServices); - cli = new CLI(); - -// Mockito.when(msgService.generateMsg( -// Mockito.anyString(), -// Mockito.anyObject() -// )).thenReturn("{ \"service\":\"msgService\" }"); + } - + @After public void tearDown() { System.clearProperty(PropertiesConfig.TEST_MODE); @@ -68,22 +91,65 @@ public void tearDown() { // reset error code since it is static CliOptions.cleanErrorCodes(); } - + @Test - public void testRunCliOptionsHFlag() throws Exception { + public void testRunCliOptionsHFlag() throws Exception { String[] args = {"-h"}; CliOptions.parse(args); - cli.run(args); + cli.run(args); int code = 0; - assertTrue(CliOptions.getErrorCodes().contains(code)); + assertTrue(CliOptions.getErrorCodes().contains(code)); } - + @Test - public void testRunCliOptionsMissingFlags() throws Exception { + public void testRunCliOptionsMissingFlags() throws Exception { String[] args = {""}; CliOptions.parse(args); - cli.run(args); + cli.run(args); int code = CLIExitCodes.CLI_MISSING_OPTION_EXCEPTION; - assertTrue(CliOptions.getErrorCodes().contains(code)); + assertTrue(CliOptions.getErrorCodes().contains(code)); + } + + @Test + public void testCreateExchangeDisable() throws Exception { + PowerMockito.mockStatic(PublishUtils.class); + Mockito.when(PublishUtils.getMessageService(Mockito.eq("eiffelsemantics"), Mockito.any())) + .thenReturn(eiffelsemanticsMsgService); + Mockito.when(eiffelsemanticsMsgService.getServiceName()).thenReturn("eiffelsemantics"); + Mockito.doThrow(new RemRemPublishException("message")).when(rmqHelper) + .rabbitMqPropertiesInit(Mockito.anyString()); + File file = new File("src/test/resources/publishMessages.json"); + if (file.exists()) { + System.out.println("fileExist"); + } + String[] args = { "-f", "src/test/resources/publishMessages.json", "-mb", "127.0.0.1", "-exchange_name", + "1test", "-ce", "false", "-mp", "eiffelsemantics" }; + CliOptions.parse(args); + cli.run(args); + int code = CLIExitCodes.HANDLE_CONTENT_FAILED; + assertTrue(CliOptions.getErrorCodes().contains(code)); + } + + @Test + public void testCreateExchangeEnable() throws Exception { + PowerMockito.mockStatic(PublishUtils.class); + Mockito.when(PublishUtils.getMessageService(Mockito.eq("eiffelsemantics"), Mockito.any())) + .thenReturn(eiffelsemanticsMsgService); + Mockito.when(eiffelsemanticsMsgService.getServiceName()).thenReturn("eiffelsemantics"); + Mockito.when(messageService.send(Mockito.anyString(), Mockito.any(), Mockito.isNull(), Mockito.isNull(), + Mockito.isNull())).thenReturn(res); + JsonArray jarray = new JsonArray(); + List results = new ArrayList<>(); + jarray.add(results.add(resultItem)); + Mockito.when(res.getEvents()).thenReturn(results); + File file = new File("src/test/resources/publishMessages.json"); + if (file.exists()) { + System.out.println("fileExist"); + } + String[] args = { "-f", "src/test/resources/publishMessages.json", "-mb", "127.0.0.1", "-exchange_name", + "1test", "-ce", "true", "-mp", "eiffelsemantics" }; + CliOptions.parse(args); + cli.run(args); + assertTrue(CliOptions.getErrorCodes().isEmpty()); } } diff --git a/publish-cli/src/test/resources/publishMessages.json b/publish-cli/src/test/resources/publishMessages.json new file mode 100644 index 00000000..f0afde92 --- /dev/null +++ b/publish-cli/src/test/resources/publishMessages.json @@ -0,0 +1,50 @@ +{ + "meta": { + "id": "29f9b8b1-9d4b-41cf-9f42-4e6157850755", + "type": "EiffelActivityFinishedEvent", + "version": "1.1.0", + "time": 1499076743638, + "tags": ["tag1", "tag2"], + "source": { + "domainId": "domainID", + "host": "host", + "name": "name", + "serializer": { + "groupId": "G", + "artifactId": "A", + "version": "V" + }, + "uri": "http://java.sun.com/j2se/1.3/" + }, + "security": { + "sdm": { + "authorIdentity": "test", + "encryptedDigest": "sample" + } + } + }, + "data": { + "outcome": { + "conclusion": "TIMED_OUT", + "description": "Compilation timed out." + }, + "persistentLogs": [{ + "name": "firstLog", + "uri": "http://myHost.com/firstLog" + }, { + "name": "otherLog", + "uri": "http://myHost.com/firstLog33" + }], + "customData": [{ + "key": "firstLog", + "value": "http://myHost.com/firstLog" + }, { + "key": "otherLog", + "value": "http://myHost.com/firstLog33" + }] + }, + "links": [{ + "type": "ACTIVITY_EXECUTION", + "target": "aaaaaaaa-bbbb-5ccc-8ddd-eeeeeeeeeee1" + }] +} \ No newline at end of file diff --git a/publish-common/pom.xml b/publish-common/pom.xml index bc9a283c..17c09cf8 100644 --- a/publish-common/pom.xml +++ b/publish-common/pom.xml @@ -127,6 +127,18 @@ spring-boot-starter-test test + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.version} + test + org.jasypt jasypt diff --git a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/PropertiesConfig.java b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/PropertiesConfig.java index d7e4e33c..059fb5f8 100644 --- a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/PropertiesConfig.java +++ b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/PropertiesConfig.java @@ -25,10 +25,10 @@ public class PropertiesConfig { public static final String DEBUG = "Debug"; public static final String DOMAIN_ID = "com.ericsson.eiffel.remrem.publish.domain"; - public static final String INVALID_EVENT_CONTENT = "Invalid event content, client need to fix problem in event before submitting again"; - public static final String INVALID_MESSAGE = "Bad Request"; - public static final String SUCCESS = "SUCCESS"; - + public static final String INVALID_EVENT_CONTENT = "Invalid event content, client need to fix problem in event before submitting again"; + public static final String INVALID_MESSAGE = "Bad Request"; + public static final String SUCCESS = "SUCCESS"; + public static final String EVENT_ID = "eventId"; public static final String ID = "id"; public static final String META = "meta"; @@ -37,6 +37,11 @@ public class PropertiesConfig { public static final String SUCCESS_MESSAGE = "Event sent successfully"; public static final String SERVICE_UNAVAILABLE = "Service Unavailable"; + public static final String CREATE_EXCHANGE_IF_NOT_EXISTING = "com.ericsson.eiffel.remrem.publish.messagebus.createExchange"; + public static final String INVALID_EXCHANGE = "Exchange not found, Please check exchange configuration and try again"; + public static final String INVALID_EXCHANGE_MESSAGE_CLI = " Unavailable. To create the exchange specify -ce or --create_exchange to true )"; + public static final String INVALID_EXCHANGE_MESSAGE_SERVICE = " ExchangeName is not present, To create the exchange specify createExchangeIfNotExisting in application configuration"; + public static final String SERVER_DOWN = "Internal Server Error"; public static final String SERVER_DOWN_MESSAGE = "RabbitMQ is down. Please try later"; public static final String ROUTING_KEY_GENERATION_FAILED_CONTENT = "Could not prepare Routing key to publish message"; diff --git a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/RabbitMqPropertiesConfig.java b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/RabbitMqPropertiesConfig.java index 8d852126..d65d4e3a 100644 --- a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/RabbitMqPropertiesConfig.java +++ b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/config/RabbitMqPropertiesConfig.java @@ -45,7 +45,7 @@ public class RabbitMqPropertiesConfig { @Value("${rabbitmq.instances.jsonlist:{null}}") private String rabbitmqInstancesJsonListContent; - @Value("${jasypt.encryptor.password}") + @Value("${jasypt.encryptor.password:{null}}") private String jasyptPassword; private Map rabbitMqPropertiesMap = new HashMap(); @@ -109,6 +109,7 @@ private void readSpringProperties() { rabbitMqProperties.setPassword(DecryptionUtils.decryptString(rabbitmqInstanceObject.get("password").asText(), jasyptPassword)); rabbitMqProperties.setTlsVer(rabbitmqInstanceObject.get("tls").asText()); rabbitMqProperties.setExchangeName(rabbitmqInstanceObject.get("exchangeName").asText()); + rabbitMqProperties.setCreateExchangeIfNotExisting(rabbitmqInstanceObject.get("createExchangeIfNotExisting").asBoolean()); rabbitMqProperties.setDomainId(rabbitmqInstanceObject.get("domainId").asText()); rabbitMqPropertiesMap.put(protocol, rabbitMqProperties); @@ -148,6 +149,9 @@ private void populateRabbitMqConfigurationsBasedOnCatalinaProperties(Map rabbitMqPro } @PostConstruct - public void init() { + public void init() throws RemRemPublishException { if (!Boolean.getBoolean(PropertiesConfig.CLI_MODE)) { log.info("RMQHelper init ..."); rabbitMqPropertiesMap = rabbitMqPropertiesConfig.getRabbitMqProperties(); @@ -63,22 +64,24 @@ public void init() { } } - /*** + /** * This method is used to set protocol specific RabbitMQ properties * @param protocol name + * @throws RemRemPublishException */ - public void rabbitMqPropertiesInit(String protocol) { + public void rabbitMqPropertiesInit(String protocol) throws RemRemPublishException{ if(!rabbitMqPropertiesMap.containsKey(protocol)) { rabbitMqPropertiesMap.put(protocol, new RabbitMqProperties()); protocolInit(protocol); } } - /*** + /** * This method is used to set the values of protocol and initialize the RabbitMq properties * @param protocol name + * @throws RemRemPublishException */ - private void protocolInit(String protocol) { + private void protocolInit(String protocol) throws RemRemPublishException{ rabbitMqPropertiesMap.get(protocol).setProtocol(protocol); rabbitMqPropertiesMap.get(protocol).init(); } diff --git a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RabbitMqProperties.java b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RabbitMqProperties.java index 4d209f14..283d1698 100644 --- a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RabbitMqProperties.java +++ b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/helper/RabbitMqProperties.java @@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory; import com.ericsson.eiffel.remrem.publish.config.PropertiesConfig; +import com.ericsson.eiffel.remrem.publish.exception.RemRemPublishException; import com.rabbitmq.client.AMQP.BasicProperties; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; @@ -48,6 +49,7 @@ public class RabbitMqProperties { private String username; private String password; private String domainId; + private boolean createExchangeIfNotExisting; private Connection rabbitConnection; private String protocol; @@ -112,6 +114,14 @@ public void setDomainId(String domainId) { this.domainId = domainId; } + public boolean isCreateExchangeIfNotExisting() { + return createExchangeIfNotExisting; + } + + public void setCreateExchangeIfNotExisting(boolean createExchangeIfNotExisting) { + this.createExchangeIfNotExisting = createExchangeIfNotExisting; + } + public RMQBeanConnectionFactory getFactory() { return factory; } @@ -136,14 +146,13 @@ public void setRabbitConnection(Connection rabbitConnection) { this.rabbitConnection = rabbitConnection; } - public void init() { + public void init() throws RemRemPublishException { log.info("RabbitMqProperties init ..."); if (Boolean.getBoolean(PropertiesConfig.CLI_MODE)) { initCli(); } else { initService(); } - madatoryParametersCheck(); try { factory.setHost(host); @@ -182,6 +191,7 @@ public void init() { } catch (NoSuchAlgorithmException e) { log.error(e.getMessage(), e); } + checkAndCreateExchangeIfNeeded(); } /** @@ -242,13 +252,14 @@ private void setValues() { tlsVer = getValuesFromSystemProperties(PropertiesConfig.TLS); exchangeName = getValuesFromSystemProperties(PropertiesConfig.EXCHANGE_NAME); usePersitance = Boolean.getBoolean(PropertiesConfig.USE_PERSISTENCE); + createExchangeIfNotExisting = Boolean.parseBoolean(getValuesFromSystemProperties(PropertiesConfig.CREATE_EXCHANGE_IF_NOT_EXISTING)); } private String getValuesFromSystemProperties(String propertyName) { return System.getProperty(propertyName); } - /**** + /** * This method is used to check mandatory RabbitMQ properties. */ private void madatoryParametersCheck() { @@ -259,7 +270,96 @@ private void madatoryParametersCheck() { } } } - /**** + + /** + * This method is used to check for checking exchange availability, if + * exchange is not available creates a new exchange based on isCreateExchangeIfNotExisting true boolean property . + * @throws RemRemPublishException + * @throws TimeoutException + * @throws IOException + */ + public void checkAndCreateExchangeIfNeeded() throws RemRemPublishException { + final boolean exchangeAlreadyExist = hasExchange(); + if (!exchangeAlreadyExist) { + if (isCreateExchangeIfNotExisting()) { + Connection connection = null; + try { + connection = factory.newConnection(); + } catch (final IOException | TimeoutException e) { + throw new RemRemPublishException("Exception occurred while creating Rabbitmq connection ::" + factory.getHost() + ":" + factory.getPort() + e.getMessage()); + } + Channel channel = null; + try { + channel = connection.createChannel(); + } catch (final IOException e) { + throw new RemRemPublishException("Exception occurred while creating Channel with Rabbitmq connection ::" + factory.getHost() + ":" + factory.getPort() + e.getMessage()); + } + try { + channel.exchangeDeclare(exchangeName, "topic", true); + } catch (final IOException e) { + log.info(exchangeName + "failed to create an exchange"); + throw new RemRemPublishException("Unable to create Exchange with Rabbitmq connection " + exchangeName + factory.getHost() + ":" + factory.getPort() + e.getMessage()); + } finally { + if (channel == null || channel.isOpen()) { + try { + channel.close(); + connection.close(); + } catch (IOException | TimeoutException e) { + log.warn("Exception occurred while closing the channel" + e.getMessage()); + } + } + } + } else { + if (!Boolean.getBoolean(PropertiesConfig.CLI_MODE)) { + throw new RemRemPublishException(exchangeName + PropertiesConfig.INVALID_EXCHANGE_MESSAGE_SERVICE); + } else { + throw new RemRemPublishException("Exchange " + exchangeName + PropertiesConfig.INVALID_EXCHANGE_MESSAGE_CLI); + } + } + } + } + + /** + * This method is used to check exchange exists or not + * @return Boolean + * @throws RemRemPublishException + * @throws TimeoutException + * @throws IOException + */ + private boolean hasExchange() throws RemRemPublishException { + log.info("Exchange is: " + exchangeName); + Connection connection; + try { + connection = factory.newConnection(); + } catch (final IOException | TimeoutException e) { + throw new RemRemPublishException("Exception occurred while creating Rabbitmq connection ::" + factory.getHost() + factory.getPort() + e.getMessage()); + } + Channel channel = null; + try { + channel = connection.createChannel(); + } catch (final IOException e) { + log.info("Exchange " + exchangeName + " does not Exist"); + throw new RemRemPublishException("Exception occurred while creating Channel with Rabbitmq connection ::" + factory.getHost() + factory.getPort() + e.getMessage()); + } + try { + channel.exchangeDeclarePassive(exchangeName); + return true; + } catch (final IOException e) { + log.info("Exchange " + exchangeName + " does not Exist"); + return false; + } finally { + if (channel != null && channel.isOpen()) { + try { + channel.close(); + connection.close(); + } catch (IOException | TimeoutException e) { + log.warn("Exception occurred while closing the channel" + e.getMessage()); + } + } + } + } + + /** * This method is used to publish the message to RabbitMQ * @param routingKey * @param msg is Eiffel Event @@ -293,7 +393,7 @@ public void shutdownCompleted(ShutdownSignalException cause) { exchangeName, routingKey); } - /*** + /** * This method is used to give random channel * @return channel */ diff --git a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/service/MessageServiceRMQImpl.java b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/service/MessageServiceRMQImpl.java index 9a95c648..8710326a 100644 --- a/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/service/MessageServiceRMQImpl.java +++ b/publish-common/src/main/java/com/ericsson/eiffel/remrem/publish/service/MessageServiceRMQImpl.java @@ -30,6 +30,7 @@ import com.ericsson.eiffel.remrem.protocol.MsgService; import com.ericsson.eiffel.remrem.publish.config.PropertiesConfig; +import com.ericsson.eiffel.remrem.publish.exception.RemRemPublishException; import com.ericsson.eiffel.remrem.publish.helper.PublishUtils; import com.ericsson.eiffel.remrem.publish.helper.RMQHelper; import com.google.gson.JsonArray; @@ -200,7 +201,11 @@ public SendResult send(JsonElement json, MsgService msgService, String userDomai private String sendMessage(String routingKey, String msg, MsgService msgService) { String resultMsg = PropertiesConfig.SUCCESS; - instantiateRmqHelper(); + try { + instantiateRmqHelper(); + } catch (RemRemPublishException e) { + log.error("RemRemPublishException occurred::" + e.getMessage()); + } try { rmqHelper.send(routingKey, msg, msgService); } catch (Exception e) { @@ -210,7 +215,7 @@ private String sendMessage(String routingKey, String msg, MsgService msgService) return resultMsg; } - private void instantiateRmqHelper() { + private void instantiateRmqHelper() throws RemRemPublishException { if (rmqHelper == null) { rmqHelper = new RMQHelper(); rmqHelper.init(); diff --git a/publish-common/src/test/java/com/ericsson/eiffel/remrem/publish/helper/RMQHelperUnitTest.java b/publish-common/src/test/java/com/ericsson/eiffel/remrem/publish/helper/RMQHelperUnitTest.java index 12a13daa..cb1a203a 100644 --- a/publish-common/src/test/java/com/ericsson/eiffel/remrem/publish/helper/RMQHelperUnitTest.java +++ b/publish-common/src/test/java/com/ericsson/eiffel/remrem/publish/helper/RMQHelperUnitTest.java @@ -26,16 +26,21 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; import com.ericsson.eiffel.remrem.publish.config.PropertiesConfig; import com.ericsson.eiffel.remrem.publish.config.RabbitMqPropertiesConfig; import com.rabbitmq.client.Connection; - +@RunWith(PowerMockRunner.class) +@PrepareForTest({ RabbitMqProperties.class, RMQHelper.class }) public class RMQHelperUnitTest { private static final String mBusHost= "HostA"; @@ -47,6 +52,7 @@ public class RMQHelperUnitTest { private static final String usePersistence= "1.2"; private static final String domainId= "eiffelxxx"; private String protocol = "eiffelsemantics"; + private String createExchange = "true"; @InjectMocks RMQHelper rmqHelper; @@ -54,8 +60,8 @@ public class RMQHelperUnitTest { @Mock RMQBeanConnectionFactory factory; @Mock Connection mockConnection; @Mock com.rabbitmq.client.Channel mockChannel; - RabbitMqProperties rabbitMqProperties = new RabbitMqProperties(); @Mock RabbitMqPropertiesConfig rabbitMqPropertiesConfig; + RabbitMqProperties rabbitMqProperties = new RabbitMqProperties(); Map rabbitMqPropertiesMap = new HashMap(); @@ -64,9 +70,10 @@ public class RMQHelperUnitTest { Mockito.doNothing().when(factory).useSslProtocol(); Mockito.when(factory.newConnection()).thenReturn(mockConnection); Mockito.when(mockConnection.createChannel()).thenReturn(mockChannel); + PowerMockito.whenNew(RabbitMqProperties.class).withNoArguments().thenReturn(rabbitMqProperties); initProperties(); + rabbitMqProperties.setFactory(factory); rmqHelper.rabbitMqPropertiesInit(protocol); - rmqHelper.rabbitMqPropertiesMap.get(protocol).setFactory(factory); } @After public void tearDown() throws Exception { @@ -89,6 +96,8 @@ private void initProperties() { System.setProperty(key, tlsVer); key = PropertiesConfig.USE_PERSISTENCE; System.setProperty(key, usePersistence); + key = PropertiesConfig.CREATE_EXCHANGE_IF_NOT_EXISTING; + System.setProperty(key, createExchange); key = PropertiesConfig.DOMAIN_ID; System.setProperty(key, domainId); } @@ -108,6 +117,8 @@ private void cleanProperties() { System.clearProperty(key); key = PropertiesConfig.USE_PERSISTENCE; System.clearProperty(key); + key = PropertiesConfig.CREATE_EXCHANGE_IF_NOT_EXISTING; + System.setProperty(key, createExchange); key = PropertiesConfig.DOMAIN_ID; System.clearProperty(key); } diff --git a/publish-service/src/main/java/com/ericsson/eiffel/remrem/publish/controller/ProducerController.java b/publish-service/src/main/java/com/ericsson/eiffel/remrem/publish/controller/ProducerController.java index 17dc4ecd..703fb2ed 100644 --- a/publish-service/src/main/java/com/ericsson/eiffel/remrem/publish/controller/ProducerController.java +++ b/publish-service/src/main/java/com/ericsson/eiffel/remrem/publish/controller/ProducerController.java @@ -15,7 +15,6 @@ package com.ericsson.eiffel.remrem.publish.controller; import java.util.Map; - import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -33,13 +32,15 @@ import org.springframework.web.client.RestTemplate; import com.ericsson.eiffel.remrem.protocol.MsgService; -import com.ericsson.eiffel.remrem.publish.constants.RemremPublishServiceConstants; import com.ericsson.eiffel.remrem.publish.helper.PublishUtils; import com.ericsson.eiffel.remrem.publish.helper.RMQHelper; import com.ericsson.eiffel.remrem.publish.service.EventTemplateHandler; import com.ericsson.eiffel.remrem.publish.service.MessageService; import com.ericsson.eiffel.remrem.publish.service.SendResult; import com.ericsson.eiffel.remrem.shared.VersionService; +import com.ericsson.eiffel.remrem.publish.constants.RemremPublishServiceConstants; +import com.ericsson.eiffel.remrem.publish.controller.GenerateURLTemplate; +import com.ericsson.eiffel.remrem.publish.exception.RemRemPublishException; import com.fasterxml.jackson.databind.JsonNode; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -99,12 +100,15 @@ public ResponseEntity send(@ApiParam(value = "message protocol", required = true @ApiParam(value = "routing key") @RequestParam(value = "rk", required = false) final String routingKey, @ApiParam(value = "eiffel event", required = true) @RequestBody final JsonElement body) { MsgService msgService = PublishUtils.getMessageService(msgProtocol, msgServices); - log.debug("mp: " + msgProtocol); log.debug("body: " + body); log.debug("user domain suffix: " + userDomain + " tag: " + tag + " Routing Key: " + routingKey); if (msgService != null && msgProtocol != null) { - rmqHelper.rabbitMqPropertiesInit(msgProtocol); + try { + rmqHelper.rabbitMqPropertiesInit(msgProtocol); + } catch (RemRemPublishException e) { + return new ResponseEntity(e.getMessage(), HttpStatus.NOT_FOUND); + } } SendResult result = messageService.send(body, msgService, userDomain, tag, routingKey); return new ResponseEntity(result, messageService.getHttpStatus()); @@ -187,7 +191,10 @@ public ResponseEntity generateAndPublish(@ApiParam(value = "message protocol", r } else { return response; } - } catch (Exception e) { + } + catch (RemRemPublishException e) { + return new ResponseEntity(e.getMessage(), HttpStatus.NOT_FOUND); + }catch (Exception e) { log.info("The result from REMReM Generate is not OK and have value: " + e.getMessage()); if (e.getMessage().startsWith(Integer.toString(HttpStatus.BAD_REQUEST.value()))) { return new ResponseEntity(parser.parse(RemremPublishServiceConstants.GENERATE_BAD_REQUEST), HttpStatus.BAD_REQUEST); diff --git a/publish-service/src/main/resources/application.properties b/publish-service/src/main/resources/application.properties index 875b75f2..08d84033 100644 --- a/publish-service/src/main/resources/application.properties +++ b/publish-service/src/main/resources/application.properties @@ -17,8 +17,8 @@ jasypt.encryptor.password: map = new HashMap(); MsgService msgService = PublishUtils.getMessageService(protocol, msgServices); map.put("test", "test"); messageService.send(map, map, msgService); } - + @Test public void testSingleSuccessfulEvent() throws Exception { String body = FileUtils.readFileToString(new File("src/test/resources/EiffelActivityFinishedEvent.json")); JsonArray jarray = new JsonArray(); @@ -89,7 +131,7 @@ public class MessageServiceRMQImplUnitTest { } assertEquals(Expected, jarray.toString()); } - + @Test public void testSingleFailedEvent() throws Exception { String body = FileUtils.readFileToString(new File("src/test/resources/Invalid_EiffelActivityFinishedEvent.json")); MsgService msgService = PublishUtils.getMessageService(protocol, msgServices); @@ -101,7 +143,7 @@ public class MessageServiceRMQImplUnitTest { } assertEquals(Expected, jarray.toString()); } - + @Test public void testMultipleFailedEvents() throws Exception { String body = FileUtils.readFileToString(new File("src/test/resources/MultipleInvalidEvents.json")); JsonArray jarray = new JsonArray(); @@ -114,6 +156,7 @@ public class MessageServiceRMQImplUnitTest { } assertEquals(Expected, jarray.toString()); } + @Test public void testMultipleSuccessfulEvents() throws Exception { String body = FileUtils.readFileToString(new File("src/test/resources/MultipleValidEvents.json")); String Expected="[{\"id\":\"9cdd0f68-df85-44b0-88bd-fc4163ac90a1\",\"status_code\":200,\"result\":\"SUCCESS\",\"message\":\"Event sent successfully\"},{\"id\":\"9cdd0f68-df85-44b0-88bd-fc4163ac90a2\",\"status_code\":200,\"result\":\"SUCCESS\",\"message\":\"Event sent successfully\"},{\"id\":\"9cdd0f68-df85-44b0-88bd-fc4163ac90a3\",\"status_code\":200,\"result\":\"SUCCESS\",\"message\":\"Event sent successfully\"}]"; diff --git a/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityStartedEvent.json b/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityStartedEvent.json index d70147fb..bef99e38 100644 --- a/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityStartedEvent.json +++ b/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityStartedEvent.json @@ -2,7 +2,7 @@ "msgParams": { "meta": { "type": "EiffelActivityStartedEvent", - "version": "3.0.0", + "version": "4.0.0", "tags": [ "product_development", "product_feature1" diff --git a/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityTriggeredEvent.json b/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityTriggeredEvent.json index 9191605f..d5c58f02 100644 --- a/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityTriggeredEvent.json +++ b/publish-service/src/test/resources/expectedParsedEvents/expected_parsed_EiffelActivityTriggeredEvent.json @@ -2,7 +2,7 @@ "msgParams": { "meta": { "type": "EiffelActivityTriggeredEvent", - "version": "3.0.0", + "version": "4.0.0", "tags": [ "product_master", "product_feature1"