Skip to content

Commit ef0a4a9

Browse files
author
SantoshNC68
authored
Added latest version for semantics in build.gradle (#54)
* Added latest version for semantics in build.gradle * Changed test cases to match semantics version * changed the URI pattern
1 parent 3a948be commit ef0a4a9

File tree

8 files changed

+83
-44
lines changed

8 files changed

+83
-44
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.7.5
2+
- upgraded semantics version in build.gradle to support all
3+
EiffelEvents in the eiffel repo from topic-drop4 branch
4+
- Changed json inputs for test cases
5+
16
## 0.7.4
27
- Fixed domain property injection in SecurityConfig
38

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ apply plugin: 'war'
1919

2020
war {
2121
baseName = 'remrem-generate'
22-
version = '0.7.4'
22+
version = '0.7.5'
2323
}
2424

2525

@@ -140,7 +140,7 @@ dependencies {
140140

141141
//Injectable Message Library and its Implementation
142142
compile ('com.github.Ericsson:eiffel-remrem-shared:0.3.0')
143-
compile ('com.github.Ericsson:eiffel-remrem-semantics:0.1.9')
143+
compile ('com.github.Ericsson:eiffel-remrem-semantics:0.2.0')
144144
compile ('com.github.Ericsson:eiffel-remrem-protocol-interface:0.0.1')
145145

146146
//commons CLI

src/integration-test/java/com/ericsson/eiffel/remrem/generate/EiffelSemanticsCli.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.io.File;
1919
import java.io.IOException;
2020
import java.io.PrintStream;
21+
import java.net.URL;
2122

2223
import static org.junit.Assert.assertTrue;
2324

@@ -61,7 +62,9 @@ public void tearDown() {
6162

6263
@Test
6364
public void testWrongMessageTypeFail() throws Exception {
64-
File file = new File(getClass().getClassLoader().getResource(artifactPublishedFileName).getFile());
65+
URL url = getClass().getClassLoader().getResource(artifactPublishedFileName);
66+
String path = url.getPath().replace("%20"," ");
67+
File file = new File(path);
6568
String filePath = file.getAbsolutePath();
6669

6770
String[] args = {"-t", "artifactpublishednone", "-f", filePath};
@@ -75,7 +78,7 @@ public void testWrongMessageTypeFail() throws Exception {
7578
@Test
7679
public void testIncompleteMessageContentFail() throws Exception {
7780
String jsonContent = "{\"msgParams\": {\"meta\":{\"fakseContent\":\"yes\"}}, \"eventParams\": {\"falseKey\" : \"none\"}}";
78-
String[] args = {"-t", "eiffelartifactpublished", "-json", jsonContent};
81+
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", jsonContent};
7982
CLIOptions.parse(args);
8083
cli.run(args);
8184
String message = bytes.toString();
@@ -86,7 +89,7 @@ public void testIncompleteMessageContentFail() throws Exception {
8689
@Test
8790
public void testMalformedJsonFail() throws Exception {
8891
String jsonContent = "{\"someKey\":\"someValue\"}";
89-
String[] args = {"-t", "eiffelartifactpublished", "-json", jsonContent};
92+
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", jsonContent};
9093
CLIOptions.parse(args);
9194
cli.run(args);
9295
String message = bytes.toString();

src/integration-test/java/com/ericsson/eiffel/remrem/generate/EiffelSemanticsController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class EiffelSemanticsController {
4141
static String activityFinishedFileName = "ActivityFinished.json";
4242
static String activityFinishedBody;
4343

44-
static String version = null;
44+
static String version = "1.0.0";
4545

4646
private String credentials = "Basic " + Base64.getEncoder().encodeToString("user:secret".getBytes());
4747

@@ -111,10 +111,10 @@ public void testUnauthenticatedNotAllowed() throws Exception {
111111
.contentType("application/json")
112112
.body(artifactPublishedBody)
113113
.when()
114-
.post("/eiffelsemantics?msgType=eiffelartifactpublished")
114+
.post("/eiffelsemantics?msgType=EiffelArtifactPublishedEvent")
115115
.then()
116116
.statusCode(HttpStatus.SC_OK)
117-
.body("meta.type", Matchers.is("eiffelartifactpublished"))
117+
.body("meta.type", Matchers.is("EiffelArtifactPublishedEvent"))
118118
.body("meta.version", Matchers.is(version));
119119
}
120120

@@ -124,10 +124,10 @@ public void testUnauthenticatedNotAllowed() throws Exception {
124124
.contentType("application/json")
125125
.body(activityFinishedBody)
126126
.when()
127-
.post("/eiffelsemantics?msgType=eiffelactivityfinished")
127+
.post("/eiffelsemantics?msgType=EiffelActivityFinishedEvent")
128128
.then()
129129
.statusCode(HttpStatus.SC_OK)
130-
.body("meta.type", Matchers.is("eiffelactivityfinished"))
130+
.body("meta.type", Matchers.is("EiffelActivityFinishedEvent"))
131131
.body("meta.version", Matchers.is(version));
132132
}
133133

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
{"msgParams": {
2-
"meta": {
3-
"type": "EiffelActivityFinishedEvent",
4-
"version": "1.0",
5-
"time": 1234567890,
6-
"domainId": "example.domain",
7-
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee0"
8-
}
9-
},
1+
{
2+
"msgParams": {
3+
"meta": {
4+
"type": "EiffelActivityFinishedEvent",
5+
"version": "1.0.0",
6+
"tags": [
7+
"tag1",
8+
"tag2"
9+
],
10+
"source": {
11+
"domainId": "domainID",
12+
"host": "host",
13+
"name": "name",
14+
"uri": "http://java.sun.com/j2se/1.3/",
15+
"serializer": {
16+
"groupId": "G",
17+
"artifactId": "A",
18+
"version": "V"
19+
}
20+
}
21+
}
22+
},
1023
"eventParams": {
1124
"data": {
1225
"outcome": {
@@ -20,12 +33,15 @@
2033
},
2134
{
2235
"name": "otherLog",
23-
"uri": "isbn:0-486-27557-4"
36+
"uri": "http://myHost.com/firstLog33"
2437
}
2538
]
2639
},
27-
"links": {
28-
"activityExecution": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee1"
29-
}
40+
"links": [
41+
{
42+
"type": "LinkTargetType",
43+
"target": "LinkTarget"
44+
}
45+
]
3046
}
31-
}
47+
}
Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
{"msgParams": {
2-
"meta": {
3-
"type": "EiffelArtifactPublishedEvent",
4-
"version": "1.0",
5-
"time": 1234567890,
6-
"domainId": "example.domain",
7-
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee0"
8-
}
9-
},
1+
{
2+
"msgParams": {
3+
"meta": {
4+
"type": "EiffelArtifactPublishedEvent",
5+
"version": "1.0.0",
6+
"tags": [
7+
"tag1",
8+
"tag2"
9+
],
10+
"source": {
11+
"domainId": "example.domain",
12+
"host": "host",
13+
"name": "name",
14+
"uri": "http://java.sun.com/j2se/1.3/",
15+
"serializer": {
16+
"groupId": "G",
17+
"artifactId": "A",
18+
"version": "V"
19+
}
20+
}
21+
}
22+
},
1023
"eventParams": {
1124
"data": {
1225
"locations": [
@@ -20,9 +33,11 @@
2033
}
2134
]
2235
},
23-
"links": {
24-
"context": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee1",
25-
"artifact": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee2"
26-
}
36+
"links": [
37+
{
38+
"type": "LinkTargetType",
39+
"target": "LinkTarget"
40+
}
41+
]
2742
}
28-
}
43+
}

src/main/java/com/ericsson/eiffel/remrem/generate/cli/CLI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private void handleJsonString(String jsonString, CommandLine commandLine) {
179179
}
180180

181181
private String handleMsgTypeArgs(CommandLine commandLine) {
182-
String msgType = commandLine.getOptionValue("t").toLowerCase(Locale.ROOT);
182+
String msgType = commandLine.getOptionValue("t");
183183
Pattern p = Pattern.compile("(.*)event");
184184
Matcher m = p.matcher(msgType);
185185
if (m.matches()) {

src/test/java/com/ericsson/eiffel/remrem/generate/cli/CliUnitTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void tearDown() {
6060

6161
@Test
6262
public void testHandleFileArgsFail() throws Exception {
63-
String[] args = {"-t", "artifactpublished", "-f", "filename"};
63+
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-f", "filename"};
6464
CLIOptions.parse(args);
6565
cli.run(args);
6666
int code = CLIExitCodes.CLI_READ_FILE_FAILED;
@@ -74,23 +74,23 @@ public void testHandleFileArgsPass() throws Exception {
7474
File file = new File(path);
7575
String filePath = file.getAbsolutePath();
7676

77-
String[] args = {"-t", "artifactpublished", "-f", filePath};
77+
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-f", filePath};
7878
CLIOptions.parse(args);
7979
cli.run(args);
8080
assertTrue(CLIOptions.getErrorCodes().isEmpty());
8181
}
8282

8383
@Test
8484
public void testHandleJsonArgsPass() throws Exception {
85-
String[] args = {"-t", "artifactpublished", "-json", "{someKey:someValue}"};
85+
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", "{someKey:someValue}"};
8686
CLIOptions.parse(args);
8787
cli.run(args);
8888
assertTrue(CLIOptions.getErrorCodes().isEmpty());
8989
}
9090

9191
@Test
9292
public void testHandleJsonArgsFail() throws Exception {
93-
String[] args = {"-t", "artifactpublished", "-json", "filename"};
93+
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", "filename"};
9494
CLIOptions.parse(args);
9595
cli.run(args);
9696
int code = CLIExitCodes.HANDLE_JSON_STRING_FAILED;
@@ -99,7 +99,7 @@ public void testHandleJsonArgsFail() throws Exception {
9999

100100
@Test
101101
public void testHandleMsgTypeEventArgsPass() throws Exception {
102-
String[] args = {"-t", "artiFactPublishedevent", "-json", "{someKey:someValue}"};
102+
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", "{someKey:someValue}"};
103103
CLIOptions.parse(args);
104104
cli.run(args);
105105
assertTrue(CLIOptions.getErrorCodes().isEmpty());

0 commit comments

Comments
 (0)