use of com.facebook.buck.timing.DefaultClock in project buck by facebook.
the class InteractiveReportIntegrationTest method createDefectReport.
private static DefectSubmitResult createDefectReport(ProjectWorkspace workspace, ByteArrayInputStream inputStream) throws IOException, InterruptedException {
ProjectFilesystem filesystem = workspace.asCell().getFilesystem();
ObjectMapper objectMapper = ObjectMappers.newDefaultInstance();
RageConfig rageConfig = RageConfig.of(workspace.asCell().getBuckConfig());
Clock clock = new DefaultClock();
ExtraInfoCollector extraInfoCollector = Optional::empty;
TestConsole console = new TestConsole();
DefectReporter defectReporter = new DefaultDefectReporter(filesystem, objectMapper, rageConfig, BuckEventBusFactory.newInstance(clock), clock);
WatchmanDiagReportCollector watchmanDiagReportCollector = new WatchmanDiagReportCollector(filesystem, WATCHMAN_DIAG_COMMAND, createFakeWatchmanDiagProcessExecutor(console));
InteractiveReport interactiveReport = new InteractiveReport(defectReporter, filesystem, objectMapper, console, inputStream, TestBuildEnvironmentDescription.INSTANCE, VcsInfoCollector.create(new NoOpCmdLineInterface()), rageConfig, extraInfoCollector, Optional.of(watchmanDiagReportCollector));
return interactiveReport.collectAndSubmitResult().get();
}
use of com.facebook.buck.timing.DefaultClock in project buck by facebook.
the class RageConfigTest method setUp.
@BeforeClass
public static void setUp() {
clock = new DefaultClock();
eventBus = BuckEventBusFactory.newInstance(clock);
threadFactory = new CommandThreadFactory("RageConfigTest.Unused");
}
use of com.facebook.buck.timing.DefaultClock in project buck by facebook.
the class FakeBuildEngineTest method buildRuleFutureHasResult.
@Test
public void buildRuleFutureHasResult() throws Exception {
BuildTarget fakeBuildTarget = BuildTargetFactory.newInstance("//foo:bar");
SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
FakeBuildRule fakeBuildRule = new FakeBuildRule(fakeBuildTarget, pathResolver);
BuildResult fakeBuildResult = BuildResult.success(fakeBuildRule, BUILT_LOCALLY, CacheResult.miss());
FakeBuildEngine fakeEngine = new FakeBuildEngine(ImmutableMap.of(fakeBuildTarget, fakeBuildResult), ImmutableMap.of(fakeBuildTarget, new RuleKey("00")));
assertThat(fakeEngine.build(BuildEngineBuildContext.builder().setBuildContext(FakeBuildContext.NOOP_CONTEXT).setArtifactCache(new NoopArtifactCache()).setBuildId(new BuildId()).setObjectMapper(ObjectMappers.newDefaultInstance()).setClock(new DefaultClock()).build(), TestExecutionContext.newInstance(), fakeBuildRule).get(), equalTo(fakeBuildResult));
}
use of com.facebook.buck.timing.DefaultClock in project buck by facebook.
the class WatchmanWatcherIntegrationTest method setUp.
@Before
public void setUp() throws InterruptedException, IOException {
// Create an empty watchman config file.
Files.write(tmp.getRoot().resolve(".watchmanconfig"), new byte[0]);
watchman = Watchman.build(ImmutableSet.of(tmp.getRoot()), ImmutableMap.copyOf(System.getenv()), new Console(Verbosity.ALL, System.out, System.err, Ansi.withoutTty()), new DefaultClock(), Optional.empty());
assumeTrue(watchman.getWatchmanClient().isPresent());
eventBus = new EventBus();
watchmanEventCollector = new WatchmanEventCollector();
eventBus.register(watchmanEventCollector);
}
use of com.facebook.buck.timing.DefaultClock in project buck by facebook.
the class MachineReadableLogJsonViewTest method setUp.
@Before
public void setUp() {
Clock clock = new DefaultClock();
timestamp = clock.currentTimeMillis();
nanoTime = clock.nanoTime();
// Not using real value as not all JVMs will support thread user time.
threadUserNanoTime = new Random().nextLong();
threadId = 0;
buildId = new BuildId("Test");
durationTracker = new BuildRuleDurationTracker();
}
Aggregations