Search in sources :

Example 81 with EventBus

use of com.google.common.eventbus.EventBus in project graylog2-server by Graylog2.

the class KafkaJournalTest method setUp.

@Before
public void setUp() throws IOException {
    scheduler = new ScheduledThreadPoolExecutor(1);
    scheduler.prestartCoreThread();
    journalDirectory = temporaryFolder.newFolder();
    final File nodeId = temporaryFolder.newFile("node-id");
    Files.write(UUID.randomUUID().toString(), nodeId, StandardCharsets.UTF_8);
    final Configuration configuration = new Configuration() {

        @Override
        public String getNodeIdFile() {
            return nodeId.getAbsolutePath();
        }
    };
    serverStatus = new ServerStatus(configuration, EnumSet.of(ServerStatus.Capability.MASTER), new EventBus("KafkaJournalTest"), NullAuditEventSender::new);
}
Also used : Configuration(org.graylog2.Configuration) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ServerStatus(org.graylog2.plugin.ServerStatus) EventBus(com.google.common.eventbus.EventBus) File(java.io.File) Before(org.junit.Before)

Example 82 with EventBus

use of com.google.common.eventbus.EventBus in project graylog2-server by Graylog2.

the class IOStateTest method testNotEqualIfDifferentState.

@Test
public void testNotEqualIfDifferentState() throws Exception {
    EventBus eventBus = mock(EventBus.class);
    MessageInput messageInput = mock(MessageInput.class);
    IOState<MessageInput> inputState1 = new IOState<>(eventBus, messageInput, IOState.Type.RUNNING);
    IOState<MessageInput> inputState2 = new IOState<>(eventBus, messageInput, IOState.Type.STOPPED);
    assertTrue(inputState1.equals(inputState2));
    assertTrue(inputState2.equals(inputState1));
}
Also used : IOState(org.graylog2.plugin.IOState) EventBus(com.google.common.eventbus.EventBus) Test(org.junit.Test)

Example 83 with EventBus

use of com.google.common.eventbus.EventBus in project graylog2-server by Graylog2.

the class IOStateTest method testEqualsSameState.

@Test
public void testEqualsSameState() throws Exception {
    EventBus eventBus = mock(EventBus.class);
    MessageInput messageInput = mock(MessageInput.class);
    IOState<MessageInput> inputState1 = new IOState<>(eventBus, messageInput, IOState.Type.RUNNING);
    IOState<MessageInput> inputState2 = new IOState<>(eventBus, messageInput, IOState.Type.RUNNING);
    assertTrue(inputState1.equals(inputState2));
    assertTrue(inputState2.equals(inputState1));
}
Also used : IOState(org.graylog2.plugin.IOState) EventBus(com.google.common.eventbus.EventBus) Test(org.junit.Test)

Example 84 with EventBus

use of com.google.common.eventbus.EventBus in project SmartCity-Market by TechnionYP5777.

the class BarcodeEventHandler method initializeHandler.

@Override
public void initializeHandler() throws IOException {
    this.scannerSocket = new ServerSocket(BARCODE_SCANNER_DEFAULT_PORT, backlog);
    eventBus = new EventBus();
}
Also used : ServerSocket(java.net.ServerSocket) EventBus(com.google.common.eventbus.EventBus)

Aggregations

EventBus (com.google.common.eventbus.EventBus)84 Test (org.junit.Test)56 BuckEventBus (com.facebook.buck.event.BuckEventBus)21 FakeClock (com.facebook.buck.timing.FakeClock)19 EasyMock.anyObject (org.easymock.EasyMock.anyObject)18 Reporter (com.google.devtools.build.lib.events.Reporter)15 WatchEvent (java.nio.file.WatchEvent)12 Subscribe (com.google.common.eventbus.Subscribe)11 AnalysisResult (com.google.devtools.build.lib.analysis.BuildView.AnalysisResult)8 Before (org.junit.Before)8 Path (com.google.devtools.build.lib.vfs.Path)7 FakeWatchmanClient (com.facebook.buck.io.FakeWatchmanClient)6 ActionExecutionMetadata (com.google.devtools.build.lib.actions.ActionExecutionMetadata)4 ResourceHandle (com.google.devtools.build.lib.actions.ResourceManager.ResourceHandle)4 BuildLangTypedAttributeValuesMap (com.google.devtools.build.lib.packages.RuleFactory.BuildLangTypedAttributeValuesMap)4 HashMap (java.util.HashMap)4 Executor (com.google.devtools.build.lib.actions.Executor)3 Event (com.google.devtools.build.lib.events.Event)3 SuiteHint (com.carrotsearch.ant.tasks.junit4.balancers.SuiteHint)2 AggregatedQuitEvent (com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedQuitEvent)2