Examples of locked()


Examples of test.aop.Lockable.locked()

            CannotBeUnlocked.class
        ),
        CannotBeUnlocked.class);
    assertThat(proxy, instanceOf(Lockable.class));
    Lockable lockable = proxy;
    assertTrue("Already locked", lockable.locked());
    lockable.lock();
    assertTrue("Real target ignores locking", lockable.locked());
    try {
      lockable.unlock();
      fail();
View Full Code Here

Examples of test.aop.Lockable.locked()

        CannotBeUnlocked.class);
    assertThat(proxy, instanceOf(Lockable.class));
    Lockable lockable = proxy;
    assertTrue("Already locked", lockable.locked());
    lockable.lock();
    assertTrue("Real target ignores locking", lockable.locked());
    try {
      lockable.unlock();
      fail();
    }
    catch (UnsupportedOperationException ex) {
View Full Code Here

Examples of test.aop.Lockable.locked()

    Modifiable modifiable = (Modifiable) createProxy(target,
        advisors,
        ITestBean.class);
    assertThat(modifiable, instanceOf(Modifiable.class));
    Lockable lockable = (Lockable) modifiable;
    assertFalse(lockable.locked());

    ITestBean itb = (ITestBean) modifiable;
    assertFalse(modifiable.isModified());
    int oldAge = itb.getAge();
    itb.setAge(oldAge + 1);
View Full Code Here

Examples of test.aop.Lockable.locked()

    assertFalse("Setting same value does not modify", modifiable.isModified());
    itb.setName("And now for something completely different");
    assertTrue(modifiable.isModified());

    lockable.lock();
    assertTrue(lockable.locked());
    try {
      itb.setName("Else");
      fail("Should be locked");
    }
    catch (IllegalStateException ex) {
View Full Code Here

Examples of test.mixin.Lockable.locked()

    ITestBean itb = (ITestBean) createProxy(pc);
    itb.setAge(newAge);
    assertTrue(itb.getAge() == newAge);

    Lockable lockable = (Lockable) itb;
    assertFalse(lockable.locked());
    lockable.lock();

    assertTrue(itb.getAge() == newAge);
    try {
      itb.setAge(1);
View Full Code Here

Examples of test.mixin.Lockable.locked()

      // ok
    }
    assertTrue(itb.getAge() == newAge);

    // Unlock
    assertTrue(lockable.locked());
    lockable.unlock();
    itb.setAge(1);
    assertTrue(itb.getAge() == 1);
  }
View Full Code Here

Examples of test.mixin.Lockable.locked()

    // Check two per-instance mixins were distinct
    Lockable lockable1 = (Lockable) tb;
    Lockable lockable2 = (Lockable) tb2;
    assertFalse(lockable1.locked());
    assertFalse(lockable2.locked());
    tb.setAge(65);
    assertEquals(65, tb.getAge());
    lockable1.lock();
    assertTrue(lockable1.locked());
    // Shouldn't affect second
View Full Code Here

Examples of test.mixin.Lockable.locked()

    tb.setAge(65);
    assertEquals(65, tb.getAge());
    lockable1.lock();
    assertTrue(lockable1.locked());
    // Shouldn't affect second
    assertFalse(lockable2.locked());
    // Can still mod second object
    tb2.setAge(12);
    // But can't mod first
    try {
      tb.setAge(6);
View Full Code Here

Examples of test.mixin.Lockable.locked()

    // Check two per-instance mixins were distinct
    Lockable lockable1 = (Lockable) tb;
    Lockable lockable2 = (Lockable) tb2;
    assertFalse(lockable1.locked());
    assertFalse(lockable2.locked());
    tb.setAge(65);
    assertEquals(65, tb.getAge());
    lockable1.lock();
    assertTrue(lockable1.locked());
    // Shouldn't affect second
View Full Code Here

Examples of test.mixin.Lockable.locked()

    tb.setAge(65);
    assertEquals(65, tb.getAge());
    lockable1.lock();
    assertTrue(lockable1.locked());
    // Shouldn't affect second
    assertFalse(lockable2.locked());
    // Can still mod second object
    tb2.setAge(12);
    // But can't mod first
    try {
      tb.setAge(6);
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.