Search in sources :

Example 1 with FakeJavaPackageFinder

use of com.facebook.buck.jvm.java.FakeJavaPackageFinder in project buck by facebook.

the class CleanCommandTest method createCommandRunnerParams.

private CommandRunnerParams createCommandRunnerParams() throws InterruptedException, IOException {
    projectFilesystem = new FakeProjectFilesystem();
    Cell cell = new TestCellBuilder().setFilesystem(projectFilesystem).build();
    Supplier<AndroidPlatformTarget> androidPlatformTargetSupplier = AndroidPlatformTarget.EXPLODING_ANDROID_PLATFORM_TARGET_SUPPLIER;
    return CommandRunnerParams.builder().setConsole(new TestConsole()).setStdIn(new ByteArrayInputStream("".getBytes("UTF-8"))).setCell(cell).setAndroidPlatformTargetSupplier(androidPlatformTargetSupplier).setArtifactCacheFactory(new SingletonArtifactCacheFactory(new NoopArtifactCache())).setBuckEventBus(BuckEventBusFactory.newInstance()).setParser(createMock(Parser.class)).setPlatform(Platform.detect()).setEnvironment(ImmutableMap.copyOf(System.getenv())).setJavaPackageFinder(new FakeJavaPackageFinder()).setObjectMapper(ObjectMappers.newDefaultInstance()).setClock(new DefaultClock()).setProcessManager(Optional.empty()).setWebServer(Optional.empty()).setBuckConfig(FakeBuckConfig.builder().build()).setFileHashCache(new StackedFileHashCache(ImmutableList.of())).setExecutors(ImmutableMap.of()).setBuildEnvironmentDescription(CommandRunnerParamsForTesting.BUILD_ENVIRONMENT_DESCRIPTION).setVersionedTargetGraphCache(new VersionedTargetGraphCache()).setActionGraphCache(new ActionGraphCache(new BroadcastEventListener())).setKnownBuildRuleTypesFactory(new KnownBuildRuleTypesFactory(new FakeProcessExecutor(), new FakeAndroidDirectoryResolver())).build();
}
Also used : FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) KnownBuildRuleTypesFactory(com.facebook.buck.rules.KnownBuildRuleTypesFactory) BroadcastEventListener(com.facebook.buck.event.listener.BroadcastEventListener) VersionedTargetGraphCache(com.facebook.buck.versions.VersionedTargetGraphCache) SingletonArtifactCacheFactory(com.facebook.buck.artifact_cache.SingletonArtifactCacheFactory) TestCellBuilder(com.facebook.buck.rules.TestCellBuilder) AndroidPlatformTarget(com.facebook.buck.android.AndroidPlatformTarget) ActionGraphCache(com.facebook.buck.rules.ActionGraphCache) FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) FakeJavaPackageFinder(com.facebook.buck.jvm.java.FakeJavaPackageFinder) ByteArrayInputStream(java.io.ByteArrayInputStream) NoopArtifactCache(com.facebook.buck.artifact_cache.NoopArtifactCache) FakeProcessExecutor(com.facebook.buck.util.FakeProcessExecutor) DefaultClock(com.facebook.buck.timing.DefaultClock) StackedFileHashCache(com.facebook.buck.util.cache.StackedFileHashCache) TestConsole(com.facebook.buck.testutil.TestConsole) Cell(com.facebook.buck.rules.Cell)

Example 2 with FakeJavaPackageFinder

use of com.facebook.buck.jvm.java.FakeJavaPackageFinder in project buck by facebook.

the class AuditInputCommandTest method setUp.

@Before
public void setUp() throws IOException, InterruptedException {
    console = new TestConsole();
    FakeProjectFilesystem projectFilesystem = new FakeProjectFilesystem();
    projectFilesystem.touch(Paths.get("src/com/facebook/AndroidLibraryTwo.java"));
    projectFilesystem.touch(Paths.get("src/com/facebook/TestAndroidLibrary.java"));
    projectFilesystem.touch(Paths.get("src/com/facebook/TestJavaLibrary.java"));
    Cell cell = new TestCellBuilder().setFilesystem(projectFilesystem).build();
    ArtifactCache artifactCache = new NoopArtifactCache();
    BuckEventBus eventBus = BuckEventBusFactory.newInstance();
    ObjectMapper objectMapper = ObjectMappers.newDefaultInstance();
    auditInputCommand = new AuditInputCommand();
    params = CommandRunnerParamsForTesting.createCommandRunnerParamsForTesting(console, cell, new FakeAndroidDirectoryResolver(), artifactCache, eventBus, FakeBuckConfig.builder().build(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new FakeJavaPackageFinder(), objectMapper, Optional.empty());
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) FakeJavaPackageFinder(com.facebook.buck.jvm.java.FakeJavaPackageFinder) NoopArtifactCache(com.facebook.buck.artifact_cache.NoopArtifactCache) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) TestConsole(com.facebook.buck.testutil.TestConsole) Cell(com.facebook.buck.rules.Cell) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TestCellBuilder(com.facebook.buck.rules.TestCellBuilder) ArtifactCache(com.facebook.buck.artifact_cache.ArtifactCache) NoopArtifactCache(com.facebook.buck.artifact_cache.NoopArtifactCache) Before(org.junit.Before)

Example 3 with FakeJavaPackageFinder

use of com.facebook.buck.jvm.java.FakeJavaPackageFinder in project buck by facebook.

the class QueryCommandTest method setUp.

@Before
public void setUp() throws IOException, InterruptedException {
    TestConsole console = new TestConsole();
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "query_command", tmp);
    workspace.setUp();
    ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath().toRealPath().normalize());
    Cell cell = new TestCellBuilder().setFilesystem(filesystem).build();
    AndroidDirectoryResolver androidDirectoryResolver = new FakeAndroidDirectoryResolver();
    ArtifactCache artifactCache = new NoopArtifactCache();
    BuckEventBus eventBus = BuckEventBusFactory.newInstance();
    ObjectMapper objectMapper = ObjectMappers.newDefaultInstance();
    queryCommand = new QueryCommand();
    queryCommand.outputAttributes = Suppliers.ofInstance(ImmutableSet.<String>of());
    params = CommandRunnerParamsForTesting.createCommandRunnerParamsForTesting(console, cell, androidDirectoryResolver, artifactCache, eventBus, FakeBuckConfig.builder().build(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new FakeJavaPackageFinder(), objectMapper, Optional.empty());
    executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) AndroidDirectoryResolver(com.facebook.buck.android.AndroidDirectoryResolver) TestCellBuilder(com.facebook.buck.rules.TestCellBuilder) FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) FakeJavaPackageFinder(com.facebook.buck.jvm.java.FakeJavaPackageFinder) NoopArtifactCache(com.facebook.buck.artifact_cache.NoopArtifactCache) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) TestConsole(com.facebook.buck.testutil.TestConsole) Cell(com.facebook.buck.rules.Cell) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ArtifactCache(com.facebook.buck.artifact_cache.ArtifactCache) NoopArtifactCache(com.facebook.buck.artifact_cache.NoopArtifactCache) Before(org.junit.Before)

Example 4 with FakeJavaPackageFinder

use of com.facebook.buck.jvm.java.FakeJavaPackageFinder in project buck by facebook.

the class TargetsCommandTest method setUp.

@Before
public void setUp() throws IOException, InterruptedException {
    console = new TestConsole();
    workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "target_command", tmp);
    workspace.setUp();
    filesystem = new ProjectFilesystem(workspace.getDestPath().toRealPath().normalize());
    Cell cell = new TestCellBuilder().setFilesystem(filesystem).build();
    AndroidDirectoryResolver androidDirectoryResolver = new FakeAndroidDirectoryResolver();
    ArtifactCache artifactCache = new NoopArtifactCache();
    BuckEventBus eventBus = BuckEventBusFactory.newInstance();
    objectMapper = ObjectMappers.newDefaultInstance();
    targetsCommand = new TargetsCommand();
    params = CommandRunnerParamsForTesting.createCommandRunnerParamsForTesting(console, cell, androidDirectoryResolver, artifactCache, eventBus, FakeBuckConfig.builder().build(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new FakeJavaPackageFinder(), objectMapper, Optional.empty());
    executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) AndroidDirectoryResolver(com.facebook.buck.android.AndroidDirectoryResolver) FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) FakeAndroidDirectoryResolver(com.facebook.buck.android.FakeAndroidDirectoryResolver) FakeJavaPackageFinder(com.facebook.buck.jvm.java.FakeJavaPackageFinder) NoopArtifactCache(com.facebook.buck.artifact_cache.NoopArtifactCache) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) TestConsole(com.facebook.buck.testutil.TestConsole) Cell(com.facebook.buck.rules.Cell) TestCellBuilder(com.facebook.buck.rules.TestCellBuilder) ArtifactCache(com.facebook.buck.artifact_cache.ArtifactCache) NoopArtifactCache(com.facebook.buck.artifact_cache.NoopArtifactCache) Before(org.junit.Before)

Example 5 with FakeJavaPackageFinder

use of com.facebook.buck.jvm.java.FakeJavaPackageFinder in project buck by facebook.

the class TestExecutionContext method newBuilder.

public static ExecutionContext.Builder newBuilder() {
    Map<ExecutorPool, ListeningExecutorService> executors = new HashMap<>();
    executors.put(ExecutorPool.CPU, MoreExecutors.listeningDecorator(Executors.newCachedThreadPool()));
    return ExecutionContext.builder().setConsole(new TestConsole()).setBuckEventBus(BuckEventBusFactory.newInstance()).setPlatform(Platform.detect()).setEnvironment(ImmutableMap.copyOf(System.getenv())).setJavaPackageFinder(new FakeJavaPackageFinder()).setObjectMapper(ObjectMappers.newDefaultInstance()).setClassLoaderCache(testClassLoaderCache).setExecutors(executors).setCellPathResolver(FAKE_CELL_PATH_RESOLVER);
}
Also used : FakeJavaPackageFinder(com.facebook.buck.jvm.java.FakeJavaPackageFinder) HashMap(java.util.HashMap) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) TestConsole(com.facebook.buck.testutil.TestConsole)

Aggregations

FakeJavaPackageFinder (com.facebook.buck.jvm.java.FakeJavaPackageFinder)8 TestConsole (com.facebook.buck.testutil.TestConsole)5 FakeAndroidDirectoryResolver (com.facebook.buck.android.FakeAndroidDirectoryResolver)4 NoopArtifactCache (com.facebook.buck.artifact_cache.NoopArtifactCache)4 Cell (com.facebook.buck.rules.Cell)4 TestCellBuilder (com.facebook.buck.rules.TestCellBuilder)4 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)4 ArtifactCache (com.facebook.buck.artifact_cache.ArtifactCache)3 BuckEventBus (com.facebook.buck.event.BuckEventBus)3 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)3 Path (java.nio.file.Path)3 Before (org.junit.Before)3 AndroidDirectoryResolver (com.facebook.buck.android.AndroidDirectoryResolver)2 ResourcesRootPackageFinder (com.facebook.buck.jvm.java.ResourcesRootPackageFinder)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Test (org.junit.Test)2 AndroidPlatformTarget (com.facebook.buck.android.AndroidPlatformTarget)1 SingletonArtifactCacheFactory (com.facebook.buck.artifact_cache.SingletonArtifactCacheFactory)1 BroadcastEventListener (com.facebook.buck.event.listener.BroadcastEventListener)1 InMemoryBuildFileTree (com.facebook.buck.model.InMemoryBuildFileTree)1