Examples of recordSuccess()


Examples of no.kommune.bergen.soa.svarut.util.InvocationRecord.recordSuccess()

  @Test
  public void violateMoreExceptionsThanSuccesses() throws InterruptedException {
    InvocationRecord ir = new InvocationRecord( "testA" );
    ir.addPolicy( new MaxAcceptableFailureRate( .01 ) );
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordSuccess();
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordException( "EXCEPTION" );
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordException( "EXCEPTION" );
    assertTrue( ir.reportPolicyViolations().indexOf( "failure rate bigger" ) > -1 );
View Full Code Here

Examples of no.kommune.bergen.soa.svarut.util.InvocationRecord.recordSuccess()

  @Test
  public void violateExceptionRate() throws InterruptedException {
    InvocationRecord ir = new InvocationRecord( "testA" );
    ir.addPolicy( new MaxAcceptableFailureRate( .01 ) );
    for (int i = 0; i < 98; i++) {
      ir.recordSuccess();
    }
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordException( "EXCEPTION" );
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordException( "EXCEPTION" );
View Full Code Here

Examples of no.kommune.bergen.soa.svarut.util.InvocationRecord.recordSuccess()

  @Test
  public void reportPolicyViolations() {
    InvocationRecord ir = new InvocationRecord( "testA" );
    ir.addPolicy( new RecurringFailureLimit( 2 ) );
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordSuccess();
    ir.recordException( "Shit happens!" );
    ir.recordException( "Shit happens!" );
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordException( "Shit happens!" );
    assertTrue( ir.reportPolicyViolations().indexOf( "failed more than" ) > -1 );
View Full Code Here

Examples of no.kommune.bergen.soa.svarut.util.InvocationRecord.recordSuccess()

    ir.recordException( "Shit happens!" );
    ir.recordException( "Shit happens!" );
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordException( "Shit happens!" );
    assertTrue( ir.reportPolicyViolations().indexOf( "failed more than" ) > -1 );
    ir.recordSuccess();
    assertEquals( "", ir.reportPolicyViolations() );
    ir.recordException( "Shit happens!" );
    assertEquals( "", ir.reportPolicyViolations() );
  }
}
View Full Code Here

Examples of no.kommune.bergen.soa.svarut.util.InvocationRecord.recordSuccess()

  @Test
  public void violateNotInvokedForTooLong() throws InterruptedException {
    InvocationRecord ir = new InvocationRecord( "testA" );
    ir.addPolicy( new TimeLimitBetweenInvocations( 1 ) );
    ir.recordSuccess();
    Thread.sleep( 10 );
    String report = ir.reportPolicyViolations();
    assertTrue( report.indexOf( "too long" ) > -1 );
  }
View Full Code Here

Examples of no.kommune.bergen.soa.svarut.util.InvocationRecord.recordSuccess()

  @Test
  public void notViolated() throws InterruptedException {
    InvocationRecord ir = new InvocationRecord( "testA" );
    ir.addPolicy( new TimeLimitBetweenInvocations( 1000 * 60 * 60 * 3 ) );
    ir.recordSuccess();
    String report = ir.reportPolicyViolations();
    assertEquals( "", report );
  }

}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.