Skip to content

Commit

Permalink
Added latest version for semantics in build.gradle (#54)
Browse files Browse the repository at this point in the history
* Added latest version for semantics in build.gradle

* Changed test cases to match semantics version

* changed the URI pattern
  • Loading branch information
SantoshNC68 authored Feb 1, 2017
1 parent 3a948be commit ef0a4a9
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 44 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.7.5
- upgraded semantics version in build.gradle to support all
EiffelEvents in the eiffel repo from topic-drop4 branch
- Changed json inputs for test cases

## 0.7.4
- Fixed domain property injection in SecurityConfig

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ apply plugin: 'war'

war {
baseName = 'remrem-generate'
version = '0.7.4'
version = '0.7.5'
}


Expand Down Expand Up @@ -140,7 +140,7 @@ dependencies {

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

//commons CLI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URL;

import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -61,7 +62,9 @@ public void tearDown() {

@Test
public void testWrongMessageTypeFail() throws Exception {
File file = new File(getClass().getClassLoader().getResource(artifactPublishedFileName).getFile());
URL url = getClass().getClassLoader().getResource(artifactPublishedFileName);
String path = url.getPath().replace("%20"," ");
File file = new File(path);
String filePath = file.getAbsolutePath();

String[] args = {"-t", "artifactpublishednone", "-f", filePath};
Expand All @@ -75,7 +78,7 @@ public void testWrongMessageTypeFail() throws Exception {
@Test
public void testIncompleteMessageContentFail() throws Exception {
String jsonContent = "{\"msgParams\": {\"meta\":{\"fakseContent\":\"yes\"}}, \"eventParams\": {\"falseKey\" : \"none\"}}";
String[] args = {"-t", "eiffelartifactpublished", "-json", jsonContent};
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", jsonContent};
CLIOptions.parse(args);
cli.run(args);
String message = bytes.toString();
Expand All @@ -86,7 +89,7 @@ public void testIncompleteMessageContentFail() throws Exception {
@Test
public void testMalformedJsonFail() throws Exception {
String jsonContent = "{\"someKey\":\"someValue\"}";
String[] args = {"-t", "eiffelartifactpublished", "-json", jsonContent};
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", jsonContent};
CLIOptions.parse(args);
cli.run(args);
String message = bytes.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class EiffelSemanticsController {
static String activityFinishedFileName = "ActivityFinished.json";
static String activityFinishedBody;

static String version = null;
static String version = "1.0.0";

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

Expand Down Expand Up @@ -111,10 +111,10 @@ public void testUnauthenticatedNotAllowed() throws Exception {
.contentType("application/json")
.body(artifactPublishedBody)
.when()
.post("/eiffelsemantics?msgType=eiffelartifactpublished")
.post("/eiffelsemantics?msgType=EiffelArtifactPublishedEvent")
.then()
.statusCode(HttpStatus.SC_OK)
.body("meta.type", Matchers.is("eiffelartifactpublished"))
.body("meta.type", Matchers.is("EiffelArtifactPublishedEvent"))
.body("meta.version", Matchers.is(version));
}

Expand All @@ -124,10 +124,10 @@ public void testUnauthenticatedNotAllowed() throws Exception {
.contentType("application/json")
.body(activityFinishedBody)
.when()
.post("/eiffelsemantics?msgType=eiffelactivityfinished")
.post("/eiffelsemantics?msgType=EiffelActivityFinishedEvent")
.then()
.statusCode(HttpStatus.SC_OK)
.body("meta.type", Matchers.is("eiffelactivityfinished"))
.body("meta.type", Matchers.is("EiffelActivityFinishedEvent"))
.body("meta.version", Matchers.is(version));
}

Expand Down
44 changes: 30 additions & 14 deletions src/integration-test/resources/ActivityFinished.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{"msgParams": {
"meta": {
"type": "EiffelActivityFinishedEvent",
"version": "1.0",
"time": 1234567890,
"domainId": "example.domain",
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee0"
}
},
{
"msgParams": {
"meta": {
"type": "EiffelActivityFinishedEvent",
"version": "1.0.0",
"tags": [
"tag1",
"tag2"
],
"source": {
"domainId": "domainID",
"host": "host",
"name": "name",
"uri": "http://java.sun.com/j2se/1.3/",
"serializer": {
"groupId": "G",
"artifactId": "A",
"version": "V"
}
}
}
},
"eventParams": {
"data": {
"outcome": {
Expand All @@ -20,12 +33,15 @@
},
{
"name": "otherLog",
"uri": "isbn:0-486-27557-4"
"uri": "http://myHost.com/firstLog33"
}
]
},
"links": {
"activityExecution": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee1"
}
"links": [
{
"type": "LinkTargetType",
"target": "LinkTarget"
}
]
}
}
}
43 changes: 29 additions & 14 deletions src/integration-test/resources/ArtifactPublished.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{"msgParams": {
"meta": {
"type": "EiffelArtifactPublishedEvent",
"version": "1.0",
"time": 1234567890,
"domainId": "example.domain",
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee0"
}
},
{
"msgParams": {
"meta": {
"type": "EiffelArtifactPublishedEvent",
"version": "1.0.0",
"tags": [
"tag1",
"tag2"
],
"source": {
"domainId": "example.domain",
"host": "host",
"name": "name",
"uri": "http://java.sun.com/j2se/1.3/",
"serializer": {
"groupId": "G",
"artifactId": "A",
"version": "V"
}
}
}
},
"eventParams": {
"data": {
"locations": [
Expand All @@ -20,9 +33,11 @@
}
]
},
"links": {
"context": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee1",
"artifact": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeee2"
}
"links": [
{
"type": "LinkTargetType",
"target": "LinkTarget"
}
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private void handleJsonString(String jsonString, CommandLine commandLine) {
}

private String handleMsgTypeArgs(CommandLine commandLine) {
String msgType = commandLine.getOptionValue("t").toLowerCase(Locale.ROOT);
String msgType = commandLine.getOptionValue("t");
Pattern p = Pattern.compile("(.*)event");
Matcher m = p.matcher(msgType);
if (m.matches()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void tearDown() {

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

String[] args = {"-t", "artifactpublished", "-f", filePath};
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-f", filePath};
CLIOptions.parse(args);
cli.run(args);
assertTrue(CLIOptions.getErrorCodes().isEmpty());
}

@Test
public void testHandleJsonArgsPass() throws Exception {
String[] args = {"-t", "artifactpublished", "-json", "{someKey:someValue}"};
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", "{someKey:someValue}"};
CLIOptions.parse(args);
cli.run(args);
assertTrue(CLIOptions.getErrorCodes().isEmpty());
}

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

@Test
public void testHandleMsgTypeEventArgsPass() throws Exception {
String[] args = {"-t", "artiFactPublishedevent", "-json", "{someKey:someValue}"};
String[] args = {"-t", "EiffelArtifactPublishedEvent", "-json", "{someKey:someValue}"};
CLIOptions.parse(args);
cli.run(args);
assertTrue(CLIOptions.getErrorCodes().isEmpty());
Expand Down

0 comments on commit ef0a4a9

Please sign in to comment.