Skip to content

Commit

Permalink
Release XLT 8.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jowerner committed Jul 5, 2024
2 parents f7d0f60 + 716f867 commit 1b429c8
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 62 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.xceptance</groupId>
<artifactId>xlt</artifactId>
<version>8.2.0</version>
<version>8.2.1</version>
<packaging>jar</packaging>

<name>XLT</name>
Expand Down
18 changes: 8 additions & 10 deletions src/main/java/com/xceptance/xlt/engine/DataManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Optional;
import java.util.function.Supplier;

import com.xceptance.common.util.CsvUtils;
import com.xceptance.xlt.api.engine.Data;
Expand Down Expand Up @@ -70,9 +72,9 @@ public class DataManagerImpl implements DataManager
private volatile BufferedWriter logger;

/**
* Our reference to metrics
* Our metrics provider.
*/
private final Metrics metrics;
private final Supplier<Metrics> metrics;

/**
* Back-reference to session using this data manager.
Expand All @@ -88,9 +90,9 @@ public class DataManagerImpl implements DataManager
* @param session
* the session that should use this data manager
* @param metrics
* a metrics target for real time loggiing
* a metrics target for real time logging
*/
protected DataManagerImpl(final Session session, final Metrics metrics)
protected DataManagerImpl(final Session session, final Supplier<Metrics> metrics)
{
this.session = session;
this.metrics = metrics;
Expand All @@ -104,8 +106,7 @@ protected DataManagerImpl(final Session session, final Metrics metrics)
*/
protected DataManagerImpl(final Session session)
{
this.session = session;
this.metrics = null;
this(session, null);
}

/**
Expand Down Expand Up @@ -139,10 +140,7 @@ public void logEvent(final String eventName, final String message)
public void logDataRecord(final Data stats)
{
// update metrics for real-time reporting
if (metrics != null)
{
metrics.updateMetrics(stats);
}
Optional.ofNullable(metrics).map(Supplier::get).ifPresent((m) -> m.updateMetrics(stats));

// Check whether the data record falls into the logging period.
// Take the data record's (start) time as the criterion.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/xceptance/xlt/engine/SessionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public SessionImpl(final XltPropertiesImpl properties)
totalAgentCount = 1;

// create the session-specific helper objects
dataManagerImpl = new DataManagerImpl(this, Metrics.getInstance());
dataManagerImpl = new DataManagerImpl(this, Metrics::getInstance);
shutdownListeners = new ArrayList<SessionShutdownListener>();
networkDataManagerImpl = new NetworkDataManagerImpl();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private ErrorCounter(final XltPropertiesImpl properties)
this.resetInterval = tmpInterval * 1000;
if (resetInterval > 0)
{
timer = new Timer("ErrorCounter-ResetTimer");
timer = new Timer("ErrorCounter-ResetTimer", true);
}
else
{
Expand Down
87 changes: 48 additions & 39 deletions src/test/java/com/xceptance/xlt/agent/DataRecordLoggingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@
{
SessionImpl.class, DataManagerImpl.class, GlobalClock.class, AbstractExecutionTimer.class
})
@PowerMockIgnore({"javax.*", "org.xml.*", "org.w3c.dom.*"})
@PowerMockIgnore(
{
"javax.*", "org.xml.*", "org.w3c.dom.*"
})
public class DataRecordLoggingTest
{
/**
Expand Down Expand Up @@ -662,7 +665,13 @@ private void mockDataManagerCreation() throws Exception
public DataManagerImpl answer(InvocationOnMock invocation) throws Throwable
{
// limit to constructor new DataManagerImpl(Session) and avoid using (Session, Metrics)
final DataManagerImpl instance = Whitebox.invokeConstructor(DataManagerImpl.class, invocation.getArguments()[0]);
final DataManagerImpl instance = Whitebox.invokeConstructor(DataManagerImpl.class, new Class<?>[]
{
Session.class
}, new Object[]
{
invocation.getArgument(0, Session.class)
});
return mockDataManagers.computeIfAbsent(Thread.currentThread().getThreadGroup(), __ -> createMockDataManager(instance));
}
});
Expand Down Expand Up @@ -915,15 +924,15 @@ public static void setGenericLoadTestImplementationFor(final Thread thread, fina

enum KindOfLoadTestClass
{
/**
* Use a load test class that is derived from {@link AbstractTestCase}
*/
XltDerived(GenericLoadTestClasses.XltDerived.class, true),
/**
* Use a load test class that is derived from {@link AbstractTestCase}
*/
XltDerived(GenericLoadTestClasses.XltDerived.class, true),

/**
* Use a load test class that is not derived from anything except Object
*/
NotDerived(GenericLoadTestClasses.NotDerived.class, false);
/**
* Use a load test class that is not derived from anything except Object
*/
NotDerived(GenericLoadTestClasses.NotDerived.class, false);

private KindOfLoadTestClass(Class<?> genericTestClassObject, boolean isXltDerived)
{
Expand Down Expand Up @@ -955,35 +964,35 @@ public boolean isXltDerived()

enum TestExecutionThreadStrategy
{
/**
* Use a {@link LoadTestRunner} thread to execute the load test class
*/
LoadTestRunner(true)
{
@Override
public Thread createThreadFor(Class<?> loadTestClassObject, TestUserConfiguration testUserConfiguration, AgentInfo agentInfo,
DataRecordLoggingTest thisTestInstance)
{
return new LoadTestRunner(testUserConfiguration, agentInfo, dummyExecutionTimer());
}

},

/**
* Use a simple thread that will just call JUnit's
* <code>{@linkplain Request#aClass(Class) Request.aClass(Class)}.getRunner().run(RunNotifier)</code> to execute
* the load test class
*/
JUnitClassRequestRunner(false)
{
@Override
public Thread createThreadFor(Class<?> loadTestClassObject, TestUserConfiguration testUserConfiguration, AgentInfo agentInfo,
DataRecordLoggingTest thisTestInstance)
{
final Runnable r = () -> Request.aClass(loadTestClassObject).getRunner().run(new RunNotifier());
return new Thread(new ThreadGroup("JUnitRequestRunner"), r);
}
};
/**
* Use a {@link LoadTestRunner} thread to execute the load test class
*/
LoadTestRunner(true)
{
@Override
public Thread createThreadFor(Class<?> loadTestClassObject, TestUserConfiguration testUserConfiguration, AgentInfo agentInfo,
DataRecordLoggingTest thisTestInstance)
{
return new LoadTestRunner(testUserConfiguration, agentInfo, dummyExecutionTimer());
}

},

/**
* Use a simple thread that will just call JUnit's
* <code>{@linkplain Request#aClass(Class) Request.aClass(Class)}.getRunner().run(RunNotifier)</code> to execute
* the load test class
*/
JUnitClassRequestRunner(false)
{
@Override
public Thread createThreadFor(Class<?> loadTestClassObject, TestUserConfiguration testUserConfiguration, AgentInfo agentInfo,
DataRecordLoggingTest thisTestInstance)
{
final Runnable r = () -> Request.aClass(loadTestClassObject).getRunner().run(new RunNotifier());
return new Thread(new ThreadGroup("JUnitRequestRunner"), r);
}
};

private TestExecutionThreadStrategy(final boolean usesLoadTestRunner)
{
Expand Down
20 changes: 10 additions & 10 deletions src/test/java/com/xceptance/xlt/engine/DataManagerImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void after() throws IOException
public void loggingPeriod() throws IOException
{
var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

dm.setStartOfLoggingPeriod(8000L);
dm.setEndOfLoggingPeriod(9000L);
Expand Down Expand Up @@ -125,7 +125,7 @@ public void loggingOnAndOff() throws IOException
GlobalClock.installFixed(1666646047921L);

var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

dm.enableLogging();
assertTrue(dm.isLoggingEnabled());
Expand Down Expand Up @@ -161,7 +161,7 @@ public void loggingOnAndOff_Legacy() throws IOException
GlobalClock.installFixed(1666646047921L);

var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

dm.setLoggingEnabled(true);
assertTrue(dm.isLoggingEnabled());
Expand Down Expand Up @@ -198,7 +198,7 @@ public void close() throws IOException
GlobalClock.installFixed(1666646047921L);

var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

dm.logEvent("EventName1", "Just a message1");

Expand Down Expand Up @@ -226,7 +226,7 @@ public void logEvent() throws IOException
GlobalClock.installFixed(1666646047921L);

var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

dm.logEvent("EventName", "Just a message");

Expand Down Expand Up @@ -293,7 +293,7 @@ public void simpleConstructor() throws IOException
public void dontCountOtherThanEvent() throws IOException
{
var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

var c = new CustomData("Custom");
c.setTime(1000L);
Expand All @@ -315,7 +315,7 @@ public void dontCountOtherThanEvent() throws IOException
public void logEventAppend() throws IOException
{
var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

GlobalClock.installFixed(1666646047921L);
dm.logEvent("EventName1", "M1");
Expand All @@ -328,7 +328,7 @@ public void logEventAppend() throws IOException
session.clear();

session = new TestSession("TName");
dm = new DataManagerImpl(session, metrics);
dm = new DataManagerImpl(session, () -> metrics);

GlobalClock.installFixed(1666646047923L);
dm.logEvent("EventName3", "M3");
Expand Down Expand Up @@ -357,7 +357,7 @@ public void logEventAppend() throws IOException
public void numberOfEvents()
{
var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

GlobalClock.installFixed(1666646047921L);
dm.logEvent("EventName1", "M1");
Expand All @@ -376,7 +376,7 @@ public void numberOfEvents()
public void directLogging() throws IOException
{
var session = new TestSession("TName");
var dm = new DataManagerImpl(session, metrics);
var dm = new DataManagerImpl(session, () -> metrics);

var e = new EventData();
e.setTime(1000L);
Expand Down

0 comments on commit 1b429c8

Please sign in to comment.