use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method expectedErrorRightMessage.
@Test
public void expectedErrorRightMessage() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_error_good_message_test");
try {
try {
throwException("definitely right");
fail("The expected exception was not thrown");
} catch (Throwable t) {
}
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("OtherTransaction/Custom/test.newrelic.test.agent.ExpectedErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(1, statsEngine.getStats("ErrorsExpected/all").getCallCount());
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 0, 1);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 0, 0, 0);
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method expectedMessagesFallbackExpected.
@Test
public void expectedMessagesFallbackExpected() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_messages_fallback_test");
try {
try {
throwException(new ExpectedError("expected"));
fail("The expected exception was not thrown");
} catch (Throwable t) {
}
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("OtherTransaction/Custom/test.newrelic.test.agent.ExpectedErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 0, 3);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 0, 0, 0);
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method expectedClassMessagesFallbackNotIgnored.
@Test
public void expectedClassMessagesFallbackNotIgnored() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_class_messages_fallback_test");
try {
try {
// This should be allowed through as a normal error
throwException(new IgnoredError("blah"));
fail("The expected exception was not thrown");
} catch (Throwable t) {
}
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("OtherTransaction/Custom/test.newrelic.test.agent.ExpectedErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(1, statsEngine.getStats("Errors/all").getCallCount());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 1, 2);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 0, 0, 1);
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreErrorWrongMessage.
@Test
public void ignoreErrorWrongMessage() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("ignore_error_bad_message_test");
try {
try {
throwException("pleasen be right");
fail("The expected exception was not thrown");
} catch (Throwable t) {
}
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("OtherTransaction/Custom/test.newrelic.test.agent.IgnoreErrorsTest/throwException", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(1, statsEngine.getStats("Errors/all").getCallCount());
} finally {
holder.close();
}
}
use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class IgnoreErrorsTest method ignoreStatusSoClose.
@Test
public void ignoreStatusSoClose() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("non_ignore_status_code_test");
try {
reportStatusCode();
// Verify the transaction was created and finished
TransactionDataList transactionList = holder.getTransactionList();
ServiceFactory.getHarvestService().harvestNow();
assertEquals(1, transactionList.size());
TransactionData td = transactionList.get(0);
assertEquals("WebTransaction/NormalizedUri/420/*", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(1, statsEngine.getStats("Errors/all").getCallCount());
assertEquals(1, statsEngine.getApdexStats(MetricName.create(MetricNames.APDEX)).getApdexFrustrating());
} finally {
holder.close();
}
}
Aggregations