Search in sources :

Example 1 with WebServerBuckEventListener

use of com.facebook.buck.httpserver.WebServerBuckEventListener in project buck by facebook.

the class WebServerBuckEventListenerTest method hasBuckTestStartedThenEventsCalled.

@Test
@Ignore
public void hasBuckTestStartedThenEventsCalled() throws IOException, InterruptedException {
    final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "buck_events/test", tmp);
    workspace.setUp();
    WebServerBuckEventListener webServerBuckEventListener = createMock(WebServerBuckEventListener.class);
    //Build started
    webServerBuckEventListener.buildStarted(anyObject(BuildEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Build progress Event
    webServerBuckEventListener.buildProgressUpdated(anyObject(ProgressEvent.BuildProgressUpdated.class));
    EasyMock.expectLastCall().atLeastOnce();
    //Build finished
    webServerBuckEventListener.buildFinished(anyObject(BuildEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Parse started
    webServerBuckEventListener.parseStarted(anyObject(ParseEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Parse progress Event
    webServerBuckEventListener.parsingProgressUpdated(anyObject(ProgressEvent.ParsingProgressUpdated.class));
    EasyMock.expectLastCall().atLeastOnce();
    //Parse finished
    webServerBuckEventListener.parseFinished(anyObject(ParseEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Individual test started
    //This target has only 1 test
    webServerBuckEventListener.testAwaitingResults(anyObject(IndividualTestEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Individual test finished
    webServerBuckEventListener.testResultsAvailable(anyObject(IndividualTestEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Test started
    webServerBuckEventListener.testRunStarted(anyObject(TestRunEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Test finished
    webServerBuckEventListener.testRunCompleted(anyObject(TestRunEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Output trace
    webServerBuckEventListener.outputTrace(anyObject(BuildId.class));
    EasyMock.expectLastCall().times(1);
    EasyMock.replay(webServerBuckEventListener);
    ProjectWorkspace.ProcessResult build = workspace.runBuckdCommand(new TestContext(), "test", "//:simple_test");
    build.assertSuccess();
    verify(webServerBuckEventListener);
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildId(com.facebook.buck.model.BuildId) TestContext(com.facebook.buck.testutil.integration.TestContext) WebServerBuckEventListener(com.facebook.buck.httpserver.WebServerBuckEventListener) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with WebServerBuckEventListener

use of com.facebook.buck.httpserver.WebServerBuckEventListener in project buck by facebook.

the class WebServerBuckEventListenerTest method hasBuckCompilerErrorOccurredThenEventsCalled.

@Test
@Ignore
public void hasBuckCompilerErrorOccurredThenEventsCalled() throws IOException, InterruptedException {
    final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "buck_events/compiler_error", tmp);
    workspace.setUp();
    WebServerBuckEventListener webServerBuckEventListener = createMock(WebServerBuckEventListener.class);
    //Build started
    webServerBuckEventListener.buildStarted(anyObject(BuildEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Build progress Event
    webServerBuckEventListener.buildProgressUpdated(anyObject(ProgressEvent.BuildProgressUpdated.class));
    EasyMock.expectLastCall().atLeastOnce();
    //Build finished
    webServerBuckEventListener.buildFinished(anyObject(BuildEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Parse started
    webServerBuckEventListener.parseStarted(anyObject(ParseEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Parse progress Event
    webServerBuckEventListener.parsingProgressUpdated(anyObject(ProgressEvent.ParsingProgressUpdated.class));
    EasyMock.expectLastCall().atLeastOnce();
    //Parse finished
    webServerBuckEventListener.parseFinished(anyObject(ParseEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Compiler error
    webServerBuckEventListener.compilerErrorEvent(anyObject(CompilerErrorEvent.class));
    EasyMock.expectLastCall().times(1);
    //Console event
    webServerBuckEventListener.consoleEvent(anyObject(ConsoleEvent.class));
    EasyMock.expectLastCall().times(1);
    //Output trace
    webServerBuckEventListener.outputTrace(anyObject(BuildId.class));
    EasyMock.expectLastCall().times(1);
    EasyMock.replay(webServerBuckEventListener);
    ProjectWorkspace.ProcessResult build = workspace.runBuckdCommand(new TestContext(), "build", "//:broken");
    build.assertFailure();
    verify(webServerBuckEventListener);
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildId(com.facebook.buck.model.BuildId) CompilerErrorEvent(com.facebook.buck.event.CompilerErrorEvent) ConsoleEvent(com.facebook.buck.event.ConsoleEvent) TestContext(com.facebook.buck.testutil.integration.TestContext) WebServerBuckEventListener(com.facebook.buck.httpserver.WebServerBuckEventListener) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with WebServerBuckEventListener

use of com.facebook.buck.httpserver.WebServerBuckEventListener in project buck by facebook.

the class WebServerBuckEventListenerTest method hasBuckBuildStartedThenEventsCalled.

@Test
@Ignore
public void hasBuckBuildStartedThenEventsCalled() throws IOException, InterruptedException {
    final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "buck_events", tmp);
    workspace.setUp();
    WebServerBuckEventListener webServerBuckEventListener = createMock(WebServerBuckEventListener.class);
    //Build started
    webServerBuckEventListener.buildStarted(anyObject(BuildEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Build progress Event
    webServerBuckEventListener.buildProgressUpdated(anyObject(ProgressEvent.BuildProgressUpdated.class));
    EasyMock.expectLastCall().atLeastOnce();
    //Build finished
    webServerBuckEventListener.buildFinished((BuildEvent.Finished) anyObject());
    EasyMock.expectLastCall().times(1);
    //Parse started
    webServerBuckEventListener.parseStarted(anyObject(ParseEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Parse progress Event
    webServerBuckEventListener.parsingProgressUpdated((ProgressEvent.ParsingProgressUpdated) anyObject());
    EasyMock.expectLastCall().atLeastOnce();
    //Parse finished
    webServerBuckEventListener.parseFinished((ParseEvent.Finished) anyObject());
    EasyMock.expectLastCall().times(1);
    //Output trace
    webServerBuckEventListener.outputTrace(anyObject(BuildId.class));
    EasyMock.expectLastCall().times(1);
    EasyMock.replay(webServerBuckEventListener);
    ProjectWorkspace.ProcessResult build = workspace.runBuckdCommand(new TestContext(), "build", "//:foo");
    build.assertSuccess();
    verify(webServerBuckEventListener);
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildId(com.facebook.buck.model.BuildId) BuildEvent(com.facebook.buck.rules.BuildEvent) ParseEvent(com.facebook.buck.parser.ParseEvent) TestContext(com.facebook.buck.testutil.integration.TestContext) WebServerBuckEventListener(com.facebook.buck.httpserver.WebServerBuckEventListener) ProgressEvent(com.facebook.buck.event.ProgressEvent) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with WebServerBuckEventListener

use of com.facebook.buck.httpserver.WebServerBuckEventListener in project buck by facebook.

the class WebServerBuckEventListenerTest method hasBuckProjectGenerationStartedThenEventsCalled.

@Test
@Ignore
public void hasBuckProjectGenerationStartedThenEventsCalled() throws IOException, InterruptedException {
    final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "buck_events", tmp);
    workspace.setUp();
    WebServerBuckEventListener webServerBuckEventListener = createMock(WebServerBuckEventListener.class);
    //Parse started
    webServerBuckEventListener.parseStarted(anyObject(ParseEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Parse progress Event
    webServerBuckEventListener.parsingProgressUpdated(anyObject(ProgressEvent.ParsingProgressUpdated.class));
    EasyMock.expectLastCall().atLeastOnce();
    //Parse finished
    webServerBuckEventListener.parseFinished(anyObject(ParseEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Project generation started
    webServerBuckEventListener.projectGenerationStarted(anyObject(ProjectGenerationEvent.Started.class));
    EasyMock.expectLastCall().times(1);
    //Project generation finished
    webServerBuckEventListener.projectGenerationFinished(anyObject(ProjectGenerationEvent.Finished.class));
    EasyMock.expectLastCall().times(1);
    //Output trace
    webServerBuckEventListener.outputTrace(anyObject(BuildId.class));
    EasyMock.expectLastCall().times(1);
    EasyMock.replay(webServerBuckEventListener);
    ProjectWorkspace.ProcessResult build = workspace.runBuckdCommand(new TestContext(), "project", "//:foo");
    build.assertSuccess();
    verify(webServerBuckEventListener);
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildId(com.facebook.buck.model.BuildId) TestContext(com.facebook.buck.testutil.integration.TestContext) WebServerBuckEventListener(com.facebook.buck.httpserver.WebServerBuckEventListener) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

WebServerBuckEventListener (com.facebook.buck.httpserver.WebServerBuckEventListener)4 BuildId (com.facebook.buck.model.BuildId)4 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)4 TestContext (com.facebook.buck.testutil.integration.TestContext)4 Ignore (org.junit.Ignore)4 Test (org.junit.Test)4 CompilerErrorEvent (com.facebook.buck.event.CompilerErrorEvent)1 ConsoleEvent (com.facebook.buck.event.ConsoleEvent)1 ProgressEvent (com.facebook.buck.event.ProgressEvent)1 ParseEvent (com.facebook.buck.parser.ParseEvent)1 BuildEvent (com.facebook.buck.rules.BuildEvent)1