Skip to content

Commit

Permalink
Fix Endpoint loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cnapagoda committed Jun 19, 2015
1 parent d73eaf6 commit 6985968
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public void setEndpointMediaType(String endpointMediaType) throws RegistryExcept
EndpointUtils.setEndpointMediaType(endpointMediaType);
}

public void setIncludeNamespaceInName(String includeNamespaceInName){
EndpointUtils.setIncludeNamespaceInName(Boolean.valueOf(includeNamespaceInName));
}

public String getEndpointMediaType() throws RegistryException {
return EndpointUtils.getEndpointMediaType();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ public class EndpointUtils {
private static String endpointLocation = ENDPOINT_DEFAULT_LOCATION;
private static String endpointMediaType = CommonConstants.ENDPOINT_MEDIA_TYPE;

private static boolean includeNamespaceInName = false;

public static boolean isIncludeNamespaceInName() {
return includeNamespaceInName;
}

public static void setIncludeNamespaceInName(boolean includeNamespaceInName) {
EndpointUtils.includeNamespaceInName = includeNamespaceInName;
}

public static void setEndpointLocation(String endpointLocation) {
EndpointUtils.endpointLocation = endpointLocation;
}
Expand Down Expand Up @@ -837,7 +847,11 @@ public static String deriveEndpointNameWithNamespaceFromUrl(String url) {
String namespace = deriveEndpointNamespaceFromUrl(url).replace("//", "/");
namespace = namespace.replace("/", ".");
namespace += "-";
return ENDPOINT_RESOURCE_PREFIX + namespace +name;
if (isIncludeNamespaceInName()){
return ENDPOINT_RESOURCE_PREFIX + namespace +name;
} else {
return ENDPOINT_RESOURCE_PREFIX + name;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public void testEndpointContentWithOverview() throws RegistryException {
StringBuilder endpointContent2 = new StringBuilder();

endpointContent1.append("<endpoint xmlns=\"http://www.wso2.org/governance/metadata\"")
.append("><overview><name>ep-net.webservicex.www-convertVolume-asmx</")
.append("><overview><name>ep-convertVolume-asmx</")
.append("name><version>1.0.0</version><address>http://www.webservicex.net/con")
.append("vertVolume.asmx</address></overview></endpoint>");
endpointContent2.append("<endpoint xmlns=\"http://www.wso2.org/governance/metadata\"")
.append("><overview><name>ep-net.webservicex.www-convertMetricWeight-asmx")
.append("><overview><name>ep-convertMetricWeight-asmx")
.append("</name><version>1.0.0</version><address>http://www.webservicex.ne")
.append("t/convertMetricWeight.asmx</address></overview></endpoint>");

Expand All @@ -46,11 +46,11 @@ public void testEndpointContentWithOverview() throws RegistryException {
StringBuilder endpointContent1_2 = new StringBuilder();
StringBuilder endpointContent2_2 = new StringBuilder();
endpointContent1_2.append("<endpoint xmlns=\"http://www.wso2.org/governance/metadata\"")
.append("servicex/www/ep-convertVolume-asmx\"><overview><name>ep-net.webservicex.www-convertVolume-asmx</")
.append("servicex/www/ep-convertVolume-asmx\"><overview><name>ep-convertVolume-asmx</")
.append("name><version>1.0.0version</version><address>http://www.webservicex.net/con")
.append("vertVolume.asmx</address></overview></endpoint>");
endpointContent2_2.append("<endpoint xmlns=\"http://www.wso2.org/governance/metadata\"")
.append("><overview><name>ep-net.webservicex.www-convertMetricWeight-asmx")
.append("><overview><name>ep-convertMetricWeight-asmx")
.append("</name><version>1.0.0version</version><address>http://www.webservicex.ne")
.append("t/convertMetricWeight.asmx</address></overview></endpoint>");
//</remove>
Expand Down

0 comments on commit 6985968

Please sign in to comment.