Package no.kommune.bergen.soa.svarut.util

Examples of no.kommune.bergen.soa.svarut.util.TimeLimitBetweenInvocations


public class TimeLimitBetweenInvocationsTest {

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


  }

  @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

  }

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

  }

  @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

Related Classes of no.kommune.bergen.soa.svarut.util.TimeLimitBetweenInvocations

Copyright © 2018 www.massapicom. 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.