### Question:
MicroIntegratorRegistry extends AbstractRegistry { @Override public void newNonEmptyResource(String path, boolean isDirectory, String mediaType, String content, String propertyName) { if (registryType == MicroIntegratorRegistryConstants.LOCAL_HOST_REGISTRY) { String targetPath = resolveRegistryURI(path); if (isDirectory && !targetPath.endsWith(URL_SEPARATOR)) { targetPath += URL_SEPARATOR; } String parent = getParentPath(targetPath, isDirectory); try { if (isDirectory) { File parentFile = new File(parent); if (!parentFile.exists() && !parentFile.mkdirs()) { handleException("Unable to create directory: " + parent); } if (StringUtils.isNotEmpty(propertyName)) { writeToFile(new URI(parent), PROPERTY_EXTENTION, propertyName + "=" + content, null); } } else { String fileName = getResourceName(targetPath); if (StringUtils.isEmpty(propertyName)) { Properties metadata = new Properties(); if (mediaType != null) { metadata.setProperty(METADATA_KEY_MEDIA_TYPE, mediaType); } writeToFile(new URI(parent), fileName, content, metadata); } else { writeToFile(new URI(parent), fileName, "", null); writeToFile(new URI(parent), fileName + PROPERTY_EXTENTION, propertyName + "=" + content, null); } } } catch (Exception e) { handleException("Error when adding a new resource", e); } } else { log.warn("Creating new resource in remote registry is NOT SUPPORTED. Unable to create: " + path); } } MicroIntegratorRegistry(); static Long getResourceLastModifiedEntry(String path); static void addResourceLastModifiedEntry(String path, Long version); static void deleteResourceLastModifiedEntry(String path); @Override void init(Properties properties); @Override OMNode lookup(String key); @Override boolean isResourceExists(String key); @Override RegistryEntry getRegistryEntry(String key); @Override OMNode lookupFormat(String key); @Override RegistryEntry[] getChildren(RegistryEntry entry); @Override RegistryEntry[] getDescendants(RegistryEntry entry); @Override void delete(String path); @Override void newResource(String path, boolean isDirectory); @Override void newNonEmptyResource(String path, boolean isDirectory, String mediaType, String content,
                                    String propertyName); @Override void updateResource(String path, Object value); @Override void updateRegistryEntry(RegistryEntry entry); @Override Properties getResourceProperties(String entryKey); Resource getResource(String key);  }### Answer:
@Test public void testIllegalRegistryResourceDeployment() throws IOException { String filePath = "gov:/custom/../../checkJsScript.js"; String content = "function checkLog(mc) {\n" + "\tvar log = mc.getServiceLog();\n" + "\tlog.info(\"Logging inside Script Mediator\");\n" + "}\n"; try { microIntegratorRegistry.newNonEmptyResource(filePath, false, "application/javascript", content, ""); assert false; } catch (Exception e) { Assert.assertEquals("The registry key 'gov:/custom/../../checkJsScript.js' is illegal " + "which points to a location outside the registry", e.getMessage()); } }