-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added code for handling single endpoint in generate (#46)
* Dynamic loading of Protocol jars * Added code for single end point in generate * Added for Dynamic protocol service class loading * Added single end point as a path param * Added message protocol as part of the path * Added change in code for improving the rest calls * Added mock test for RemremGenerateController * change array to list to make easier dependency injections during tests * add working service tests * replace deprecated assert * Added some more mock tests for Remrem Generate * Deleted jar path dependent test case * Added latest version for generate in build.gradle * Changes for test cases
- Loading branch information
SantoshNC68
authored
Jan 17, 2017
1 parent
8ec0f96
commit ff5653c
Showing
19 changed files
with
259 additions
and
608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ apply plugin: 'war' | |
|
||
war { | ||
baseName = 'remrem-generate' | ||
version = '0.7.2' | ||
version = '0.7.3' | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
src/main/java/com/ericsson/eiffel/remrem/generate/controller/Eiffel3Controller.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/main/java/com/ericsson/eiffel/remrem/generate/controller/EiffelSemanticsController.java
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
src/main/java/com/ericsson/eiffel/remrem/generate/controller/RemremGenerateController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.ericsson.eiffel.remrem.generate.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.ericsson.eiffel.remrem.protocol.MsgService; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonParser; | ||
|
||
@RestController @RequestMapping("/*") | ||
public class RemremGenerateController { | ||
|
||
@Autowired | ||
private List<MsgService> msgServices; | ||
private JsonParser parser = new JsonParser(); | ||
|
||
/** | ||
* Returns event information as json element based on the message protocol, taking message type and json body as input. | ||
* | ||
* | ||
* Parameters: | ||
* mp - The message protocol , which tells us which service to invoke. | ||
* msgType - The type of message that needs to be generated. | ||
* bodyJson - The content of the message which is used in creating the event details. | ||
* | ||
* Returns: | ||
* The event information as a json element | ||
* | ||
*/ | ||
@RequestMapping(value = "/{mp}", method = RequestMethod.POST) | ||
public JsonElement generate(@PathVariable String mp, @RequestParam("msgType") String msgType, | ||
@RequestBody JsonObject bodyJson) { | ||
MsgService msgService = getMessageService(mp); | ||
if (msgService != null) { | ||
return parser.parse(msgService.generateMsg(msgType, bodyJson)); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
private MsgService getMessageService(String messageProtocol) { | ||
for (MsgService service : msgServices) { | ||
if (service.getServiceName().equals(messageProtocol)) { | ||
return service; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
94 changes: 0 additions & 94 deletions
94
src/main/java/com/ericsson/eiffel/remrem/generate/helper/RemremJarHelper.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.