@Before public void createAppClassLoader() throws IOException { // Creates folder structure previousMuleHome = setProperty(MULE_HOME_DIRECTORY_PROPERTY, tempMuleHome.getRoot().getAbsolutePath()); // Add jar file on application's lib folder File libDir = getAppLibFolder(APP_NAME); assertThat(libDir.mkdirs(), is(true)); final File appLibrary = new File(libDir, "appLibrary.jar"); stringToFile(appLibrary.getAbsolutePath(), "Some text"); when(classLoaderLookupPolicy.getClassLookupStrategy(anyString())).thenReturn(PARENT_FIRST); when(parentArtifactClassLoader.getClassLoaderLookupPolicy()).thenReturn(classLoaderLookupPolicy); when(parentArtifactClassLoader.getClassLoader()).thenReturn(getClass().getClassLoader()); when(classLoaderLookupPolicy.extend(anyMap())).thenReturn(classLoaderLookupPolicy); descriptor = new ApplicationDescriptor(APP_NAME); descriptor.setArtifactLocation(new File(tempMuleHome.newFolder(), APP_NAME)); }
File libDir = getAppLibFolder(APP_NAME); assertThat(libDir.mkdirs(), is(true)); URL resourceSrcJarFile = currentThread().getContextClassLoader().getResource("test-jar-with-resources.jar");
@Before public void createAppClassLoader() throws IOException { // Creates folder structure previousMuleHome = setProperty(MULE_HOME_DIRECTORY_PROPERTY, tempMuleHome.getRoot().getAbsolutePath()); // Add jar file on application's lib folder File libDir = getAppLibFolder(APP_NAME); assertThat(libDir.mkdirs(), is(true)); final File appLibrary = new File(libDir, "appLibrary.jar"); stringToFile(appLibrary.getAbsolutePath(), "Some text"); when(classLoaderLookupPolicy.getClassLookupStrategy(anyString())).thenReturn(PARENT_FIRST); when(parentArtifactClassLoader.getClassLoaderLookupPolicy()).thenReturn(classLoaderLookupPolicy); when(parentArtifactClassLoader.getClassLoader()).thenReturn(getClass().getClassLoader()); when(classLoaderLookupPolicy.extend(anyMap())).thenReturn(classLoaderLookupPolicy); descriptor = new ApplicationDescriptor(APP_NAME); descriptor.setArtifactLocation(new File(tempMuleHome.newFolder(), APP_NAME)); }
File libDir = getAppLibFolder(APP_NAME); assertThat(libDir.mkdirs(), is(true)); URL resourceSrcJarFile = currentThread().getContextClassLoader().getResource("test-jar-with-resources.jar");