Skip to content

Commit

Permalink
[Java] Update agent build after merge of PR #831.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Jan 21, 2020
1 parent c084213 commit 6fca7e1
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ static void roleChange(final Cluster.Role oldRole, final Cluster.Role newRole, f
LOGGER.logStateChange(ROLE_CHANGE, oldRole, newRole, memberId);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ final class DriverEventDissector
private static final SubscriptionReadyFlyweight SUBSCRIPTION_READY = new SubscriptionReadyFlyweight();
private static final ClientTimeoutFlyweight CLIENT_TIMEOUT = new ClientTimeoutFlyweight();
private static final TerminateDriverFlyweight TERMINATE_DRIVER = new TerminateDriverFlyweight();

static final String CONTEXT = "DRIVER";

private DriverEventDissector()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,4 @@ static void encodeImageRemoval(
encodeTrailingString(
encodingBuffer, offset + relativeOffset, captureLength - SIZE_OF_INT * 2 - SIZE_OF_LONG, uri);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static org.agrona.concurrent.ringbuffer.RecordDescriptor.*;
import static org.junit.jupiter.api.Assertions.*;

public class Common
public class AgentTests
{
public static void beforeAgent()
{
Expand All @@ -41,14 +41,6 @@ public static void afterAgent()
EventConfiguration.reset();
}

public static void checkInterruptedStatus()
{
if (Thread.currentThread().isInterrupted())
{
fail("unexpected interrupt - test likely to have timed out");
}
}

public static void verifyLogHeader(
final UnsafeBuffer logBuffer,
final int recordOffset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static io.aeron.agent.ArchiveEventCode.EVENT_CODE_TYPE;
import static io.aeron.agent.ArchiveEventLogger.CONTROL_REQUEST_EVENTS;
import static io.aeron.agent.ArchiveEventLogger.toEventCodeId;
import static io.aeron.agent.Common.verifyLogHeader;
import static io.aeron.agent.AgentTests.verifyLogHeader;
import static io.aeron.agent.CommonEventEncoder.LOG_HEADER_LENGTH;
import static io.aeron.agent.CommonEventEncoder.MAX_CAPTURE_LENGTH;
import static io.aeron.agent.EventConfiguration.*;
Expand All @@ -47,8 +47,7 @@
class ArchiveEventLoggerTest
{
private static final int CAPACITY = align(MAX_EVENT_LENGTH, CACHE_LINE_LENGTH) * 8;
private final UnsafeBuffer logBuffer = new UnsafeBuffer(
allocateDirect(CAPACITY + TRAILER_LENGTH));
private final UnsafeBuffer logBuffer = new UnsafeBuffer(allocateDirect(CAPACITY + TRAILER_LENGTH));
private final ArchiveEventLogger logger = new ArchiveEventLogger(new ManyToOneRingBuffer(logBuffer));
private final UnsafeBuffer srcBuffer = new UnsafeBuffer(
allocateDirect(align(MAX_EVENT_LENGTH, CACHE_LINE_LENGTH) * 3));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class ArchiveLoggingAgentTest
@AfterEach
public void after()
{
Common.afterAgent();
AgentTests.afterAgent();

LOGGED_EVENTS.clear();
WAIT_LIST.clear();
Expand Down Expand Up @@ -129,7 +129,7 @@ private void before(final String enabledEvents, final EnumSet<ArchiveEventCode>
{
System.setProperty(EventLogAgent.READER_CLASSNAME_PROP_NAME, StubEventLogReaderAgent.class.getName());
System.setProperty(EventConfiguration.ENABLED_ARCHIVE_EVENT_CODES_PROP_NAME, enabledEvents);
Common.beforeAgent();
AgentTests.beforeAgent();

latch = new CountDownLatch(expectedEvents.size());
WAIT_LIST.addAll(expectedEvents.stream().map(ArchiveEventLogger::toEventCodeId).collect(toSet()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static io.aeron.agent.ClusterEventCode.STATE_CHANGE;
import static io.aeron.agent.ClusterEventEncoder.SEPARATOR;
import static io.aeron.agent.ClusterEventLogger.toEventCodeId;
import static io.aeron.agent.Common.verifyLogHeader;
import static io.aeron.agent.AgentTests.verifyLogHeader;
import static io.aeron.agent.CommonEventEncoder.LOG_HEADER_LENGTH;
import static io.aeron.agent.EventConfiguration.MAX_EVENT_LENGTH;
import static java.nio.ByteBuffer.allocateDirect;
Expand All @@ -44,8 +44,7 @@
class ClusterEventLoggerTest
{
private static final int CAPACITY = align(MAX_EVENT_LENGTH, CACHE_LINE_LENGTH);
private final UnsafeBuffer logBuffer = new UnsafeBuffer(
allocateDirect(CAPACITY + TRAILER_LENGTH));
private final UnsafeBuffer logBuffer = new UnsafeBuffer(allocateDirect(CAPACITY + TRAILER_LENGTH));
private final ClusterEventLogger logger = new ClusterEventLogger(new ManyToOneRingBuffer(logBuffer));

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ClusterLoggingAgentTest
@AfterEach
public void after()
{
Common.afterAgent();
AgentTests.afterAgent();

LOGGED_EVENTS.clear();

Expand Down Expand Up @@ -162,7 +162,7 @@ private void before(final String enabledEvents, final int expectedEvents)
{
System.setProperty(EventLogAgent.READER_CLASSNAME_PROP_NAME, StubEventLogReaderAgent.class.getName());
System.setProperty(EventConfiguration.ENABLED_CLUSTER_EVENT_CODES_PROP_NAME, enabledEvents);
Common.beforeAgent();
AgentTests.beforeAgent();

latch = new CountDownLatch(expectedEvents);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;

import static io.aeron.agent.Common.verifyLogHeader;
import static io.aeron.agent.AgentTests.verifyLogHeader;
import static io.aeron.agent.CommonEventEncoder.LOG_HEADER_LENGTH;
import static io.aeron.agent.CommonEventEncoder.MAX_CAPTURE_LENGTH;
import static io.aeron.agent.DriverEventCode.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.aeron.Subscription;
import io.aeron.driver.MediaDriver;
import io.aeron.logbuffer.FragmentHandler;
import io.aeron.test.Tests;
import org.agrona.IoUtil;
import org.agrona.MutableDirectBuffer;
import org.agrona.collections.MutableInteger;
Expand Down Expand Up @@ -63,7 +64,7 @@ public class DriverLoggingAgentTest
@AfterEach
public void after()
{
Common.afterAgent();
AgentTests.afterAgent();

LOGGED_EVENTS.clear();
WAIT_LIST.clear();
Expand Down Expand Up @@ -149,7 +150,7 @@ private void testLogMediaDriverEvents(final String enabledEvents, final EnumSet<
while (publication.offer(offerBuffer) < 0)
{
Thread.yield();
Common.checkInterruptedStatus();
Tests.checkInterruptedStatus();
}

final MutableInteger counter = new MutableInteger();
Expand All @@ -158,7 +159,7 @@ private void testLogMediaDriverEvents(final String enabledEvents, final EnumSet<
while (0 == subscription.poll(handler, 1))
{
Thread.yield();
Common.checkInterruptedStatus();
Tests.checkInterruptedStatus();
}

assertEquals(counter.get(), 1);
Expand All @@ -175,7 +176,7 @@ private void before(final String enabledEvents, final EnumSet<DriverEventCode> e
{
System.setProperty(EventLogAgent.READER_CLASSNAME_PROP_NAME, StubEventLogReaderAgent.class.getName());
System.setProperty(EventConfiguration.ENABLED_EVENT_CODES_PROP_NAME, enabledEvents);
Common.beforeAgent();
AgentTests.beforeAgent();

latch = new CountDownLatch(expectedEvents.size());
WAIT_LIST.addAll(expectedEvents.stream().map(DriverEventCode::id).collect(toSet()));
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ project(':aeron-agent') {
dependencies {
implementation project(':aeron-cluster')
implementation "net.bytebuddy:byte-buddy:${byteBuddyVersion}"
testImplementation project(':aeron-test-support')
}

jar {
Expand Down Expand Up @@ -867,7 +868,7 @@ project(':aeron-system-tests') {
project(':aeron-test-support') {
dependencies {
api "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
implementation "org.agrona:agrona:${agronaVersion}"
api "org.agrona:agrona:${agronaVersion}"
}
}

Expand Down

0 comments on commit 6fca7e1

Please sign in to comment.