use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidReactNativeLibraryIntegrationTest method testApkContainsJSAssetAndDrawables.
@Test
public void testApkContainsJSAssetAndDrawables() throws IOException {
BuildTarget target = BuildTargetFactory.newInstance("//apps/sample:app");
workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s.apk")));
zipInspector.assertFileExists("assets/SampleBundle.js");
zipInspector.assertFileExists("res/drawable-mdpi-v4/image.png");
zipInspector.assertFileExists("res/drawable-hdpi-v4/image.png");
zipInspector.assertFileExists("res/drawable-xhdpi-v4/image.png");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidReactNativeLibraryIntegrationTest method testApkContainsJSAssetAndDrawablesForUnbundle.
@Test
public void testApkContainsJSAssetAndDrawablesForUnbundle() throws IOException {
BuildTarget target = BuildTargetFactory.newInstance("//apps/sample:app-unbundle");
workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s.apk")));
zipInspector.assertFileExists("assets/SampleBundle.js");
zipInspector.assertFileExists("assets/js/helpers.js");
zipInspector.assertFileExists("res/drawable-mdpi-v4/image.png");
zipInspector.assertFileExists("res/drawable-hdpi-v4/image.png");
zipInspector.assertFileExists("res/drawable-xhdpi-v4/image.png");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class AndroidReactNativeLibraryIntegrationTest method testApkContainsJSAssetAndDrawablesForIndexedUnbundle.
@Test
public void testApkContainsJSAssetAndDrawablesForIndexedUnbundle() throws IOException {
BuildTarget target = BuildTargetFactory.newInstance("//apps/sample:app-indexed_unbundle");
workspace.runBuckBuild(target.getFullyQualifiedName()).assertSuccess();
ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s.apk")));
zipInspector.assertFileExists("assets/SampleBundle.js");
zipInspector.assertFileDoesNotExist("assets/js/helpers.js");
zipInspector.assertFileExists("res/drawable-mdpi-v4/image.png");
zipInspector.assertFileExists("res/drawable-hdpi-v4/image.png");
zipInspector.assertFileExists("res/drawable-xhdpi-v4/image.png");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class DefaultJavaLibraryIntegrationTest method testSpoolClassFilesDirectlyToJarWithRemoveClasses.
@Test
public void testSpoolClassFilesDirectlyToJarWithRemoveClasses() throws IOException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "spool_class_files_directly_to_jar_with_remove_classes", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance("//:a");
ProcessResult result = workspace.runBuckBuild(target.getFullyQualifiedName());
result.assertSuccess();
Path classesDir = workspace.getPath(BuildTargets.getScratchPath(filesystem, target, "lib__%s__classes"));
assertThat("Classes directory should exist.", Files.exists(classesDir), is(Boolean.TRUE));
assertThat("No class files should be stored on disk.", ImmutableList.copyOf(classesDir.toFile().listFiles()), hasSize(0));
Path jarPath = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "lib__%s__output/a.jar"));
assertTrue(Files.exists(jarPath));
// Check that normal and member classes were removed as expected.
ZipInspector zipInspector = new ZipInspector(jarPath);
zipInspector.assertFileExists("test/pkg/A.class");
zipInspector.assertFileExists("test/pkg/B.class");
zipInspector.assertFileExists("test/pkg/C.class");
zipInspector.assertFileDoesNotExist("test/pkg/RemovableZ.class");
zipInspector.assertFileDoesNotExist("B$removableB.class");
zipInspector.assertFileDoesNotExist("C$deletableD.class");
}
use of com.facebook.buck.testutil.integration.ZipInspector in project buck by facebook.
the class CopyResourcesStepIntegrationTest method testGeneratedResourceIsAlongsideClassFiles.
@Test
public void testGeneratedResourceIsAlongsideClassFiles() throws IOException, InterruptedException {
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "generated_resources", temporaryFolder);
workspace.setUp();
Path exampleJar = workspace.buildAndReturnOutput("//java/com/example:example");
ZipInspector exampleInspector = new ZipInspector(exampleJar);
exampleInspector.assertFileExists("com/example/HelloWorld.class");
exampleInspector.assertFileExists("com/example/res/helloworld.txt");
Path helloWorldJar = workspace.buildAndReturnOutput("//java/com/example:HelloWorld");
ProcessExecutor.Result result = workspace.runJar(helloWorldJar);
assertEquals("hello world\n", result.getStdout().get());
assertEquals("", result.getStderr().get());
}
Aggregations