Commit ace6a2fa authored by Malo Toudic's avatar Malo Toudic
Browse files

WS for xdstools updated

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/simulators/gazelle-webservice-tester/trunk@61921 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent d769f93c
package net.ihe.gazelle.wstester.xdstools.ws;
public enum ActorType {
//todo complete role in test
xdrsrc("XDR", "todo"),
reg("XDS", "todo"),
rep("XDS", "todo"),
odds(null, "todo"),
rec("XDR", "todo"),
rg("XCA", "NHIO_RESP-QD-RD"),
lg("XCA", "NHIO_INIT-QD"),
cons("XDS", "todo"),
ids("XDS-I", "todo"),
rig("XCA-I", "todo"),
ldc("XDS-I", "todo");
String profile;
String[] roleInTests;
ActorType(String profile, String... roleInTests) {
this.profile = profile;
this.roleInTests = roleInTests;
}
public String getActorType() {
return name();
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public String[] getRoleInTests() {
return roleInTests.clone();
}
public void setRoleInTests(String[] roleInTests) {
this.roleInTests = roleInTests;
}
}
......@@ -52,6 +52,7 @@ public class Xdstools {
String integrationProfile = null;
String integrationProfileOption = null;
String actorCode = null;
String roleInTest = null;
try {
gazelleTRMServiceClient = new GazelleTRMServiceClient(callingTool.getUrl() + "/gazelle-tm-ejb/GazelleTRMService/gazelleTRM");
GazelleTRMServiceStub.TrmTestInstance trmTestInstance = gazelleTRMServiceClient.getTestInstanceById(testInstanceId);
......@@ -67,6 +68,12 @@ public class Xdstools {
actor = trmParticipant.getAipo().getActor();
integrationProfile = trmParticipant.getAipo().getIntegrationProfile();
integrationProfileOption = trmParticipant.getAipo().getIntegrationProfileOption();
int roleInTestId = trmParticipant.getRoleInTestId();
for (GazelleTRMServiceStub.TrmTestRole trmTestRole : trmTestInstance.getTest().getTrmTestRoles()) {
if (roleInTestId == trmTestRole.getRoleInTest().getId()) {
roleInTest = trmTestRole.getRoleInTest().getKeyword();
}
}
}
}
......@@ -109,7 +116,7 @@ public class Xdstools {
String response = getHTML(url);
getActorCode(actor);
if (response != null && !response.isEmpty()) {
String redirectUrl = PreferenceService.getString("xdstools_url") + "Xdstools2.html#ConfActor:default/" + response + "/" + getActorCode(actor) + "/"+ getIntegrationProfileCode(integrationProfile) + "/" + getIntegrationProfileOptionCode(integrationProfileOption) + "/" + systemKeyword;
String redirectUrl = PreferenceService.getString("xdstools_url") + "Xdstools2.html#ConfActor:default/" + response + "/" + getActorType(roleInTest) + "/" + getIntegrationProfileCode(integrationProfile) + "/" + getIntegrationProfileOptionCode(integrationProfileOption) + "/" + systemKeyword;
Nonce nonce = new Nonce(response, redirectUrl);
TestInstanceTm newTestInstanceTm = new TestInstanceTm(testInstanceId, systemKeyword, testingSession, nonce, callingTool);
nonce.addTestInstanceTm(newTestInstanceTm);
......@@ -128,6 +135,7 @@ public class Xdstools {
BufferedReader rd = null;
HttpURLConnection conn = null;
try {
urlToRead = urlToRead.replaceAll(" ", "%20");
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
......@@ -170,20 +178,37 @@ public class Xdstools {
return redirect.toString();
}
public String getActorCode (String actor){
if(actor.equals("DOC_REPOSITORY")){
public String getActorType(String currentRoleInTest) {
for (ActorType actorType : ActorType.values()) {
for (String roleInTest : actorType.getRoleInTests()) {
if (roleInTest.equals(currentRoleInTest)) {
return actorType.getActorType();
}
}
}
return "";
}
public String getActorCode(String actor) {
if (actor.equals("DOC_REPOSITORY")) {
return "rep";
} else if(actor.equals("DOC_REGISTRY")){
} else if (actor.equals("DOC_REGISTRY")) {
return "reg";
} else if(actor.equals("DOC_CONSUMER")){
} else if (actor.equals("DOC_CONSUMER")) {
return "";
} else if (actor.equals("INIT_GATEWAY")) {
return "ig";
} else if (actor.equals("INIT_GATEWAY")) {
return "ig";
} else if (actor.equals("INIT_GATEWAY")) {
return "ig";
} else {
return "";
}
}
public String getIntegrationProfileCode (String integrationProfile){
if(integrationProfile.equals("XDS.b")) {
public String getIntegrationProfileCode(String integrationProfile) {
if (integrationProfile.equals("XDS.b")) {
return "xds";
} else if (integrationProfile.equals("XDS-I.b")) {
return "xds-i";
......@@ -192,8 +217,8 @@ public class Xdstools {
}
}
public String getIntegrationProfileOptionCode (String integrationProfileOption){
if(integrationProfileOption.equals("NONE")){
public String getIntegrationProfileOptionCode(String integrationProfileOption) {
if (integrationProfileOption.equals("NONE")) {
return "";
} else {
return "";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment