Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ protected void processListFaultyServices(HttpServletRequest req, HttpServletResp
String serviceName = req.getParameter("serviceName");
if (serviceName != null) {
AxisService service = configContext.getAxisConfiguration().getService(serviceName);
req.setAttribute(Constants.SINGLE_SERVICE, service);
// listFaultyService.jsp renders the name, EPR and operations of this
// service, so it takes the same two controls the listing does.
if (service != null && !Utils.isHiddenService(service)
&& service.isMetadataExposed()) {
req.setAttribute(Constants.SINGLE_SERVICE, service);
}
}
renderView(LIST_FAULTY_SERVICES_JSP_NAME, req, res);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,36 @@ public void testAServiceHiddenByParameterIsNotListed() throws Exception {
assertFalse(listedServices().containsKey("HiddenParam"));
}

private AxisService faultyServiceModel(String serviceName) throws Exception {
HttpServletRequest req = mock(HttpServletRequest.class);
HttpServletResponse res = mock(HttpServletResponse.class);
when(req.getParameter("serviceName")).thenReturn(serviceName);
final AxisService[] captured = new AxisService[1];
org.mockito.Mockito.doAnswer(invocation -> {
if (Constants.SINGLE_SERVICE.equals(invocation.getArgument(0))) {
captured[0] = (AxisService) invocation.getArgument(1);
}
return null;
}).when(req).setAttribute(org.mockito.ArgumentMatchers.anyString(),
org.mockito.ArgumentMatchers.any());
try {
new ListingAgent(configContext).processListFaultyServices(req, res);
} catch (Exception rendering) {
// The view cannot render without a container; the model is what matters.
}
return captured[0];
}

/**
* ListFaultyServices?serviceName= renders a single service by name, so it has to
* withhold the same services the listing does.
*/
public void testFaultyServicesPageWithholdsWithheldServices() throws Exception {
assertNotNull(faultyServiceModel("Visible"));
assertNull(faultyServiceModel("NotExposed"));
assertNull(faultyServiceModel("HiddenParam"));
}

/** Nothing null reaches the model, since the view would throw on it. */
public void testNoNullServiceReachesTheModel() throws Exception {
for (AxisService service : listedServices().values()) {
Expand Down