@SuppressWarnings( { "all" } )
public class AuditEntryTest extends TestCase {
public void testAuditEntry() throws Exception {
StandaloneObjectFactory factory = new StandaloneObjectFactory();
PentahoSystem.registerObjectFactory( factory );
String jobId = "testjobid";
String instId = "testinstid";
String objId = "testobjid";
String objType = "testobjtype";
String actor = "testactor";
String messageType = "testtype";
String messageName = "testname";
String messageTxtValue = MessageTypes.INSTANCE_END;
BigDecimal messageNumValue = new BigDecimal( 99 );
float duration = (float) 1.23;
// this should not complain
AuditEntry.auditJobDuration( jobId, instId, objId, objType, actor, messageType, messageName, messageTxtValue,
duration );
TestOutputHandler.contentItem = new SimpleContentItem();
factory.defineObject( IAuditEntry.class.getSimpleName(), TestAuditEntry.class.getName(),
StandaloneObjectFactory.Scope.GLOBAL );
// this should not complain
AuditEntry.auditJobDuration( jobId, instId, objId, objType, actor, messageType, messageName, messageTxtValue,
duration );
TestAuditEntry entry = (TestAuditEntry) factory.get( IAuditEntry.class, null );
assertEquals( jobId, entry.jobId );
assertEquals( "1.23", Double.toString( entry.duration ).substring( 0, 4 ) );
assertEquals( null, entry.messageNumValue );
assertEquals( messageType, entry.messageType );
assertEquals( messageName, entry.messageName );