Skip to content
Permalink
Browse files
JUDDI-907 adding basic ui components for entity history retrieval, fi…
…xing a test case
  • Loading branch information
spyhunter99 committed Jan 9, 2015
1 parent d63e9c1 commit 8c2196b1e810d00950057ff1bdb7f3d5f2a7bc79
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
@@ -1395,7 +1395,7 @@ public void testJUDDI907_ChangeHistory3() throws Exception{
Assert.assertFalse(entityHistory.getChangeRecords().getChangeRecord().isEmpty());
}

@Test(expected = DispositionReportFaultMessage.class)
@Test
public void testJUDDI907_ChangeHistory4() throws Exception{

JUDDIApiImpl j = new JUDDIApiImpl();
@@ -72,6 +72,8 @@
import org.apache.juddi.api_v3.ClientSubscriptionInfo;
import org.apache.juddi.api_v3.DeleteClerk;
import org.apache.juddi.api_v3.DeleteNode;
import org.apache.juddi.api_v3.GetEntityHistoryMessageRequest;
import org.apache.juddi.api_v3.GetEntityHistoryMessageResponse;
import org.apache.juddi.api_v3.NodeList;
import org.apache.juddi.api_v3.SubscriptionWrapper;
import org.apache.juddi.model.BindingTemplate;
@@ -396,6 +398,9 @@ public String go(HttpServletRequest parameters) {
if (action.equalsIgnoreCase("admin_SaveSubscription")) {
return adminSaveSubscription(parameters);
}
if (action.equalsIgnoreCase("get_EntityHistory")) {
return getEntityHistory(parameters);
}
} catch (Exception ex) {
return "Error!" + HandleException(ex);
}
@@ -769,14 +774,44 @@ private String adminSaveSubscription(HttpServletRequest parameters) {
return HandleException(ex);
}
}
AdminSaveSubscriptionResponse res = new AdminSaveSubscriptionResponse()
;
AdminSaveSubscriptionResponse res = new AdminSaveSubscriptionResponse();
res.getSubscriptions().addAll(holder.value);
StringWriter sw = new StringWriter();
JAXB.marshal(res, sw);
return StringEscapeUtils.escapeHtml(sw.toString());
}

private String getEntityHistory(HttpServletRequest parameters) {
GetEntityHistoryMessageRequest sn = new GetEntityHistoryMessageRequest();
sn.setAuthInfo(GetToken());
sn.setEntityKey(parameters.getParameter("get_EntityHistoryKey"));
GetEntityHistoryMessageResponse entityHistory = null;
try {
sn.setMaxRecords(Long.parseLong(parameters.getParameter("get_EntityHistoryMaxCount")));
sn.setOffset(Long.parseLong(parameters.getParameter("get_EntityHistoryOffset")));
entityHistory = juddi.getEntityHistory(sn);
} catch (Exception ex) {
if (isExceptionExpiration(ex)) {
token = null;
sn.setAuthInfo(GetToken());
try {
entityHistory = juddi.getEntityHistory(sn);
} catch (Exception ex1) {
return "Error!" + HandleException(ex1);
}

} else {
return "Error!" + HandleException(ex);
}
}
if (entityHistory == null) {
return "Something went wrong!";
}
StringWriter sw = new StringWriter();
JAXB.marshal(entityHistory, sw);
return StringEscapeUtils.escapeHtml(sw.toString());
}

public enum AuthStyle {

/**
@@ -67,6 +67,7 @@
<option>------ Node Management -----</option>
<option>set_ReplicationNodes</option>
<option>get_ReplicationNodes</option>
<option>get_EntityHistory</option>

<option>------ Backup/Restore Management -----</option>
<option>admin_SaveBusiness</option>
@@ -206,6 +207,12 @@
<textarea rows="4" cols="80" id="admin_SaveSubscriptionXML" class="forminput" placeholder="Enter save subscription XML"></textarea>

</div>
<div id="get_EntityHistory" style="display:none">
Entity Key <input type="text" id="get_EntityHistoryKey" class="forminput" placeholder="Entity Key"><br>
Records to fetch <input type="text" id="get_EntityHistoryMaxCount" class="forminput" value="25"><br>
Offset <input type="text" id="get_EntityHistoryOffset" class="forminput" value="0"><br>
</div>




@@ -239,6 +246,7 @@
$("#set_ReplicationNodes").hide();
$("#get_ReplicationNodes").hide();
$("#admin_SaveSubscription").hide();
$("#get_EntityHistory").hide();
$("#" + x).show();

0 comments on commit 8c2196b

Please sign in to comment.