use of com.newrelic.agent.TransactionData in project newrelic-java-agent by newrelic.
the class ExpectedErrorsTest method expectedClassMessagesFallbackOverride.
@Test
public void expectedClassMessagesFallbackOverride() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_class_messages_fallback_test");
try {
try {
// Doesn't matter what the message is, it will be expected
throwException(new ExpectedError("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(0, 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 ExpectedErrorsTest method expectedStatusSoClose.
@Test
public void expectedStatusSoClose() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("non_expected_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/Custom/test.newrelic.test.agent.ExpectedErrorsTest/reportStatusCode", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(0, statsEngine.getStats("ErrorsExpected/all").getCallCount());
assertEquals(1, statsEngine.getStats("Errors/all").getCallCount());
assertEquals(1, statsEngine.getApdexStats(MetricName.create(MetricNames.APDEX)).getApdexFrustrating());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 0, 0);
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 expectedStatus.
@Test
public void expectedStatus() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_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/Custom/test.newrelic.test.agent.ExpectedErrorsTest/reportStatusCode", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(1, statsEngine.getStats("ErrorsExpected/all").getCallCount());
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
assertEquals(0, statsEngine.getApdexStats(MetricName.create(MetricNames.APDEX)).getApdexFrustrating());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 0, 0);
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 expectedStatusRange.
@Test
public void expectedStatusRange() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_status_code_range_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/Custom/test.newrelic.test.agent.ExpectedErrorsTest/reportStatusCode", td.getPriorityTransactionName().getName());
StatsEngine statsEngine = holder.getStatsEngine();
assertEquals(1, statsEngine.getStats("ErrorsExpected/all").getCallCount());
assertEquals(0, statsEngine.getStats("Errors/all").getCallCount());
assertEquals(0, statsEngine.getApdexStats(MetricName.create(MetricNames.APDEX)).getApdexFrustrating());
verifyExpectedErrorSupportabilityApiCalls(statsEngine, 0, 0, 0, 0);
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 expectedMessagesFallback.
@Test
public void expectedMessagesFallback() throws Exception {
EnvironmentHolder holder = setupEnvironemntHolder("expected_messages_fallback_test");
try {
try {
throwException(new IgnoredError("message"));
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, 0, 3);
verifyIgnoreErrorSupportabilityApiCalls(statsEngine, 0, 0, 0);
} finally {
holder.close();
}
}
Aggregations