Exemple #1
0
  public void testDestructionCallbacks() throws Exception {
    String conversationId11 = beanN1C1.getConversationId();
    String conversationId21 = beanN1C2.getConversationId();
    String conversationId12 = beanN2C1.getConversationId();
    String conversationId22 = beanN2C2.getConversationId();

    beanN1C1.setField("newVal11");
    beanN1C2.setField("newVal12");
    beanN2C1.setField("newVal21");
    beanN2C2.setField("newVal22");

    assertTrue(
        "Failed to create scoped bean", beanN1C1.isInClusteredSingletonCache(conversationId11));
    assertTrue(
        "Failed to create scoped bean", beanN1C2.isInClusteredSingletonCache(conversationId12));
    assertTrue(
        "Failed to create scoped bean", beanN2C1.isInClusteredSingletonCache(conversationId21));
    assertTrue(
        "Failed to create scoped bean", beanN2C2.isInClusteredSingletonCache(conversationId22));

    beanN1C1.invokeDestructionCallback();
    beanN2C2.invokeDestructionCallback();

    assertFalse(
        "Failed to destruct scoped bean", beanN1C1.isInClusteredSingletonCache(conversationId11));
    assertFalse(
        "Failed to destruct scoped bean", beanN1C2.isInClusteredSingletonCache(conversationId12));
    assertFalse(
        "Failed to destruct scoped bean", beanN2C1.isInClusteredSingletonCache(conversationId21));
    assertFalse(
        "Failed to destruct scoped bean", beanN2C2.isInClusteredSingletonCache(conversationId22));
  }
Exemple #2
0
  public void testScopeId() throws Exception {
    String id11 = beanN1C1.getConversationId();
    String id12 = beanN1C2.getConversationId();

    String id21 = beanN2C1.getConversationId();
    String id22 = beanN2C2.getConversationId();

    assertEquals("Unexpected scope", id11, id21);
    assertEquals("Unexpected scope", id12, id22);
  }