diff --git a/components/mediation/registry/org.wso2.micro.integrator.registry/src/test/java/org/wso2/micro/integrator/registry/TestMicroIntegratorRegistry.java b/components/mediation/registry/org.wso2.micro.integrator.registry/src/test/java/org/wso2/micro/integrator/registry/TestMicroIntegratorRegistry.java
index 9385099d4c..ce0741ddbd 100644
--- a/components/mediation/registry/org.wso2.micro.integrator.registry/src/test/java/org/wso2/micro/integrator/registry/TestMicroIntegratorRegistry.java
+++ b/components/mediation/registry/org.wso2.micro.integrator.registry/src/test/java/org/wso2/micro/integrator/registry/TestMicroIntegratorRegistry.java
@@ -76,6 +76,14 @@ public void deployRegistryResource() {
String emptyMediaTypeFilePath = "conf:/custom/QueueName";
String emptyMediaTypeFileContent = "ordersQueue";
microIntegratorRegistry.newNonEmptyResource(emptyMediaTypeFilePath, false, "", emptyMediaTypeFileContent, "");
+
+ String resourceFilePath = "gov:mi-resources/custom/checkJsScript.js";
+ String resourceContent = "function checkLog(mc) {\n"
+ + "\tvar log = mc.getServiceLog();\n"
+ + "\tlog.info(\"Logging inside Script Mediator\");\n"
+ + "}\n";
+
+ microIntegratorRegistry.newNonEmptyResource(resourceFilePath, false, "application/javascript", resourceContent, "");
}
@Test
@@ -123,6 +131,14 @@ public void testRegistryResourceRead() throws IOException {
Assert.assertEquals("Media type should be as expected", "application/javascript", mediaType);
}
+ @Test
+ public void testResourceRead() {
+
+ OMNode omNode = microIntegratorRegistry.lookup("resources:custom/checkJsScript.js");
+ String mediaType = ((DataHandler) ((OMTextImpl) omNode).getDataHandler()).getContentType();
+ Assert.assertEquals("Media type should be as expected", "application/javascript", mediaType);
+ }
+
@Test
public void testRegistryPropertiesDeploymentAndLookup() throws IOException {
diff --git a/integration/mediation-tests/tests-mediator-2/src/test/java/org/wso2/carbon/esb/mediator/test/xslt/RegistryEntryXsltTransformationTestCase.java b/integration/mediation-tests/tests-mediator-2/src/test/java/org/wso2/carbon/esb/mediator/test/xslt/RegistryEntryXsltTransformationTestCase.java
index 1c38760328..53f95be906 100644
--- a/integration/mediation-tests/tests-mediator-2/src/test/java/org/wso2/carbon/esb/mediator/test/xslt/RegistryEntryXsltTransformationTestCase.java
+++ b/integration/mediation-tests/tests-mediator-2/src/test/java/org/wso2/carbon/esb/mediator/test/xslt/RegistryEntryXsltTransformationTestCase.java
@@ -58,6 +58,15 @@ public void xsltTransformationFromGovernanceRegistry() throws Exception {
assertNotNull(response, "Response message null");
assertTrue(response.toString().contains("Code"), "Response does not contain the key word: Code");
assertTrue(response.toString().contains("IBM"), "Response does not contain the key word: IBM");
+ }
+ @Test(groups = {
+ "wso2.esb" }, description = "Do XSLT transformation by selecting the xslt file from resources.")
+ public void xsltTransformationFromResources() throws Exception {
+ OMElement response = axis2Client
+ .sendCustomQuoteRequest(getProxyServiceURLHttp("xsltInResourcesTestProxy"), null, "IBM");
+ assertNotNull(response, "Response message null");
+ assertTrue(response.toString().contains("Code"), "Response does not contain the key word: Code");
+ assertTrue(response.toString().contains("IBM"), "Response does not contain the key word: IBM");
}
}
diff --git a/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/registry/governance/mi-resources/xslt/transform.xslt b/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/registry/governance/mi-resources/xslt/transform.xslt
new file mode 100644
index 0000000000..a76afeb750
--- /dev/null
+++ b/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/registry/governance/mi-resources/xslt/transform.xslt
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/registry/governance/mi-resources/xslt/transform_back.xslt b/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/registry/governance/mi-resources/xslt/transform_back.xslt
new file mode 100644
index 0000000000..add8418630
--- /dev/null
+++ b/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/registry/governance/mi-resources/xslt/transform_back.xslt
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/repository/deployment/server/synapse-configs/default/proxy-services/xsltInResourcesTestProxy.xml b/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/repository/deployment/server/synapse-configs/default/proxy-services/xsltInResourcesTestProxy.xml
new file mode 100644
index 0000000000..d75d719075
--- /dev/null
+++ b/integration/mediation-tests/tests-mediator-2/src/test/resources/artifacts/ESB/server/repository/deployment/server/synapse-configs/default/proxy-services/xsltInResourcesTestProxy.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+