public ClassPathByteArraySource() { this(new ClassPath()); }
public ClassPath getComponent(final Predicate<ClassPathRoot> predicate) { return new ClassPath(FCollection.filter(this.root, predicate).toArray( new ClassPathRoot[0])); }
public ClassPath getClassPath() { if (this.classPathElements != null) { return createClassPathFromElements(); } else { return new ClassPath(); } }
private ClassPath createClassPathFromElements() { return new ClassPath( FCollection.map(this.classPathElements, stringToFile())); }
public ClassloaderByteArraySource(final ClassLoader loader) { this.cp = new ClassPath(new OtherClassLoaderClassPathRoot(loader)); }
public TransformingClassLoader(final Transformation transformation, final IsolationStrategy isolationStrategy) { this(new ClassPath(), transformation, isolationStrategy, XStreamCloning .bootClassLoader()); }
private ClassPath classPathWithoutJUnit() { final List<File> cpWithoutJUnit = ClassPath.getClassPathElementsAsFiles().stream() .filter(file -> !file.getName().contains("junit")) .collect(Collectors.toList()); return new ClassPath(cpWithoutJUnit); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); this.testee = new ClassPath(this.firstComponent, this.secondComponent); when(this.firstComponent.cacheLocation()).thenReturn(Optional.ofNullable("foo")); when(this.firstComponent.classNames()).thenReturn( Collections.singletonList("FooClass")); when(this.secondComponent.cacheLocation()).thenReturn(Optional.ofNullable("bar")); when(this.secondComponent.classNames()).thenReturn( Collections.singletonList("BarClass")); }
@Test public void testFoo() { final ClassLoader cl = new DefaultPITClassloader(new ClassPath(), XStreamCloning.bootClassLoader()); final Testee testee = new Testee(); final Runnable r = (Runnable) XStreamCloning.cloneForLoader(testee, cl); r.run(); }
@Override public Optional<byte[]> getBytes(final String classname) { final ClassPath cp = new ClassPath(new ResourceFolderClassPathroot()); try { return Optional.ofNullable(cp.getClassData(classname)); } catch (final IOException ex) { throw Unchecked.translateCheckedException(ex); } }
public ClassPathByteArraySource() { this(new ClassPath()); }
private ProjectClassPaths createProjectClassPaths() { final ClassPath classPath = new ClassPath(this.compiledCodeDirectories); final Predicate<String> classPredicate = createClassPredicate(); final Predicate<ClassPathRoot> pathPredicate = new DefaultCodePathPredicate(); return new ProjectClassPaths(classPath, new ClassFilter(classPredicate, classPredicate), new PathFilter(pathPredicate, Prelude.not(new DefaultDependencyPathPredicate()))); }
private void runCoverageProcess(final Class<?> test, final List<CoverageResult> coveredClasses) throws IOException, InterruptedException { final SideEffect1<CoverageResult> handler = a -> coveredClasses.add(a); final CoverageOptions sa = new CoverageOptions(coverOnlyTestees(), excludeTests(), TestPluginArguments.defaults(), true, -1); final JarCreatingJarFinder agent = new JarCreatingJarFinder(); try { final LaunchOptions lo = new LaunchOptions(agent); final SocketFinder sf = new SocketFinder(); final CoverageProcess process = new CoverageProcess(ProcessArgs .withClassPath(new ClassPath()).andLaunchOptions(lo), sa, sf.getNextAvailableServerSocket(), Arrays.asList(test.getName()), handler); process.start(); final ExitCode exitCode = process.waitToDie(); assertEquals(ExitCode.OK, exitCode); } finally { agent.close(); } }
@Test public void waitToDieShouldReturnProcessExitCode() throws IOException, InterruptedException { final LaunchOptions launchOptions = new LaunchOptions(NullJavaAgent.instance(), new DefaultJavaExecutableLocator(), Collections.<String> emptyList(), new HashMap<String, String>()); final ProcessArgs processArgs = ProcessArgs .withClassPath(new ClassPath().getLocalClassPath()) .andBaseDir(new File(System.getProperty("user.dir"))) .andLaunchOptions(launchOptions).andStdout(nullHandler()) .andStderr(nullHandler()); final WrappingProcess wrappingProcess = new WrappingProcess(-1, processArgs, getClass()); wrappingProcess.start(); final JavaProcess process = wrappingProcess.getProcess(); assertTrue(process.isAlive()); assertEquals(EXIT_CODE, process.waitToDie()); }
public ClassPath getComponent(final Predicate<ClassPathRoot> predicate) { return new ClassPath(FCollection.filter(this.root, predicate).toArray( new ClassPathRoot[0])); }
public ClassloaderByteArraySource(final ClassLoader loader) { this.cp = new ClassPath(new OtherClassLoaderClassPathRoot(loader)); }