use of com.facebook.buck.testutil.TestConsole in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testEntitlementsDoesNotMergeInvalidProfileKeys.
@Test
public void testEntitlementsDoesNotMergeInvalidProfileKeys() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
ProvisioningProfileCopyStep step = new ProvisioningProfileCopyStep(projectFilesystem, testdataDir.resolve("Info.plist"), ApplePlatform.IPHONEOS, Optional.of("00000000-0000-0000-0000-000000000000"), Optional.of(entitlementsFile), ProvisioningProfileStore.fromSearchPath(new DefaultProcessExecutor(new TestConsole()), ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
step.execute(executionContext);
ProvisioningProfileMetadata selectedProfile = step.getSelectedProvisioningProfileFuture().get().get();
ImmutableMap<String, NSObject> profileEntitlements = selectedProfile.getEntitlements();
assertTrue(profileEntitlements.containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
Optional<String> xcentContents = projectFilesystem.readFileIfItExists(xcentFile);
assertTrue(xcentContents.isPresent());
NSDictionary xcentPlist = (NSDictionary) PropertyListParser.parse(xcentContents.get().getBytes());
assertFalse(xcentPlist.containsKey("com.apple.developer.icloud-container-development-container-identifiers"));
assertEquals(xcentPlist.get("com.apple.developer.team-identifier"), profileEntitlements.get("com.apple.developer.team-identifier"));
}
use of com.facebook.buck.testutil.TestConsole in project buck by facebook.
the class ProvisioningProfileCopyStepTest method testFailsWithInvalidInfoPlist.
@Test
public void testFailsWithInvalidInfoPlist() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
thrown.expect(HumanReadableException.class);
thrown.expectMessage(startsWith("Unable to get bundle ID from info.plist"));
ProvisioningProfileCopyStep step = new ProvisioningProfileCopyStep(projectFilesystem, testdataDir.resolve("Invalid.plist"), ApplePlatform.IPHONEOS, Optional.empty(), Optional.empty(), ProvisioningProfileStore.fromSearchPath(new DefaultProcessExecutor(new TestConsole()), ProvisioningProfileStore.DEFAULT_READ_COMMAND, testdataDir), outputFile, xcentFile, codeSignIdentityStore, Optional.empty());
step.execute(executionContext);
}
use of com.facebook.buck.testutil.TestConsole in project buck by facebook.
the class ProvisioningProfileMetadataTest method testProvisioningProfileReadCommandOverride.
@Test
public void testProvisioningProfileReadCommandOverride() throws Exception {
ProcessExecutor executor = new DefaultProcessExecutor(new TestConsole());
Path testdataDir = TestDataHelper.getTestDataDirectory(this).resolve("provisioning_profiles");
ProvisioningProfileMetadata data = ProvisioningProfileMetadata.fromProvisioningProfilePath(executor, ImmutableList.of(testdataDir.resolve("fake_read_command.sh").toString()), Paths.get("unused"));
assertThat(data.getAppID(), is(equalTo(new Pair<>("0000000000", "com.example.override"))));
}
use of com.facebook.buck.testutil.TestConsole in project buck by facebook.
the class ArchiveStepIntegrationTest method emptyArchives.
@Test
public void emptyArchives() throws IOException, InterruptedException {
ProjectFilesystem filesystem = new ProjectFilesystem(tmp.getRoot());
CxxPlatform platform = CxxPlatformUtils.build(new CxxBuckConfig(FakeBuckConfig.builder().build()));
// Build up the paths to various files the archive step will use.
SourcePathResolver sourcePathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
Archiver archiver = platform.getAr();
Path output = filesystem.getPath("output.a");
// Build an archive step.
ArchiveStep archiveStep = new ArchiveStep(filesystem, archiver.getEnvironment(sourcePathResolver), archiver.getCommandPrefix(sourcePathResolver), ImmutableList.of(), getArchiveOptions(false), output, ImmutableList.of(), archiver);
// Execute the archive step and verify it ran successfully.
ExecutionContext executionContext = TestExecutionContext.newInstance();
TestConsole console = (TestConsole) executionContext.getConsole();
int exitCode = archiveStep.execute(executionContext).getExitCode();
assertEquals("archive step failed: " + console.getTextWrittenToStdErr(), 0, exitCode);
// zero'd out.
try (ArArchiveInputStream stream = new ArArchiveInputStream(new FileInputStream(filesystem.resolve(output).toFile()))) {
assertThat(stream.getNextArEntry(), Matchers.nullValue());
}
}
use of com.facebook.buck.testutil.TestConsole in project buck by facebook.
the class WatchmanTest method shouldReturnEmptyWatchmanIfVersionCheckFails.
@Test
public void shouldReturnEmptyWatchmanIfVersionCheckFails() throws InterruptedException, IOException {
SettableFakeClock clock = new SettableFakeClock(0, 0);
FakeListeningProcessExecutor executor = new FakeListeningProcessExecutor(ImmutableMultimap.<ProcessExecutorParams, FakeListeningProcessState>builder().putAll(ProcessExecutorParams.ofCommand(exe, "--output-encoding=bser", "get-sockname"), FakeListeningProcessState.ofExit(1)).build(), clock);
Watchman watchman = Watchman.build(executor, NULL_WATCHMAN_CONNECTOR, rootPaths, env, finder, new TestConsole(), clock, Optional.empty());
assertEquals(Watchman.NULL_WATCHMAN, watchman);
}
Aggregations