Java 类javax.naming.ldap.UnsolicitedNotificationEvent 实例源码

项目:cn1    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_simple() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, notification);

    assertEquals(src, event.getSource());
    assertEquals(notification, event.getNotification());

    assertSame(notification, event.getNotification());
    assertSame(src, event.getSource());
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_simple() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, notification);

    assertEquals(src, event.getSource());
    assertEquals(notification, event.getNotification());

    assertSame(notification, event.getNotification());
    assertSame(src, event.getSource());
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_simple() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, notification);

    assertEquals(src, event.getSource());
    assertEquals(notification, event.getNotification());

    assertSame(notification, event.getNotification());
    assertSame(src, event.getSource());
}
项目:cn1    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_src_null() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = null;
    try {
        new UnsolicitedNotificationEvent(
                src, notification);
    } catch (IllegalArgumentException e) {
    }
}
项目:cn1    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_notification_null() {
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, null);

    assertEquals(src, event.getSource());
    assertNull(event.getNotification());
}
项目:cn1    文件:UnsolicitedNotificationEventTest.java   
public void testDispatch() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, notification);
    MockUnsolicitedNotificationListener listener = new MockUnsolicitedNotificationListener();
    event.dispatch(listener);
    assertTrue(listener.hasEvent(event));
}
项目:cn1    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.UnsolicitedNotificationEvent(Object, UnsolicitedNotification)'</p>
 * <p>This is the constructor method that constructs a new instance of UnsolicitedNotificationEvent. In this case we are sending 
 * two null arguments. This is not specified in the API.</p>
 * <p>The expected result is an Illegal argument exception.</p>
 */
public void testUnsolicitedNotificationEvent001() {
       new UnsolicitedNotificationEvent(new Object(), null);

       try {
           new UnsolicitedNotificationEvent(null, null);
           fail("The arguments could not be null.");
       } catch (IllegalArgumentException e) {}
   }
项目:cn1    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.UnsolicitedNotificationEvent(Object, UnsolicitedNotification)'</p>
 * <p>This is the constructor method that constructs a new instance of UnsolicitedNotificationEvent. In this case we are sending 
 * one null arguments. This is not specified in the API.</p>
 * <p>The expected result is an Illegal Argument exception.</p>
 */
public void testUnsolicitedNotificationEvent003() {
       try {
           MockUnsolicitedNotification u = new MockUnsolicitedNotification();
           new UnsolicitedNotificationEvent(null, u);
           fail("The arguments could not be null.");
       } catch (IllegalArgumentException e) {}
   }
项目:cn1    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.getNotification()'</p>
 * <p>Here we are testing if the method returns the unsolicited notification. In this case we create a notification
 * with an object and a null notification as the parameters.</p>
 * <p>The expected result is a not null notification.</p>
 */
public void testGetNotification001() {
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(
               new Object(), null);

       assertNull(une.getNotification());
   }
项目:cn1    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.getNotification()'</p>
 * <p>Here we are testing if the method returns the unsolicited notification. In this case we create a notification
 * with an object and a null notification as the parameters.</p>
 * <p>The expected result is a not null notification.</p>
 */
public void testGetNotification002() {
       Object x = new Object();
       MockUnsolicitedNotification u = new MockUnsolicitedNotification();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x, u);
       assertEquals(u, une.getNotification());
   }
项目:cn1    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.dispatch(UnsolicitedNotificationListener)'</p>
 * <p>Here this method invokes the notificationReceived() method on a listener using this event. In this case we are 
 * sending as a parameter a null listener.</p>
 * <p>The expected result is a null pointer exception.</p>
 */
public void testDispatch001() {
       Object x = new Object();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x,
               new MockUnsolicitedNotification());
       try {
           une.dispatch(null);
           fail("Failed notification is null.");
       } catch (NullPointerException e) {}
   }
项目:cn1    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.dispatch(UnsolicitedNotificationListener)'</p>
 * <p>Here this method invokes the notificationReceived() method on a listener using this event. In this case we are 
 * sending as a parameter a non null listener.</p>
 * <p>The expected result is a null pointer exception.</p>
 */
public void testDispatch002() {
       Object x = new Object();
       MockUnsolicitedNotification u = new MockUnsolicitedNotification();
       MockUnsolicitedNotification f = new MockUnsolicitedNotification();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x, u);
       une.dispatch(f);
       assertTrue(f.getFlag());
   }
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_src_null() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = null;
    try {
        new UnsolicitedNotificationEvent(
                src, notification);
    } catch (IllegalArgumentException e) {
    }
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_notification_null() {
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, null);

    assertEquals(src, event.getSource());
    assertNull(event.getNotification());
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testDispatch() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, notification);
    MockUnsolicitedNotificationListener listener = new MockUnsolicitedNotificationListener();
    event.dispatch(listener);
    assertTrue(listener.hasEvent(event));
}
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.UnsolicitedNotificationEvent(Object, UnsolicitedNotification)'</p>
 * <p>This is the constructor method that constructs a new instance of UnsolicitedNotificationEvent. In this case we are sending 
 * two null arguments. This is not specified in the API.</p>
 * <p>The expected result is an Illegal argument exception.</p>
 */
public void testUnsolicitedNotificationEvent001() {
       new UnsolicitedNotificationEvent(new Object(), null);

       try {
           new UnsolicitedNotificationEvent(null, null);
           fail("The arguments could not be null.");
       } catch (IllegalArgumentException e) {}
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.UnsolicitedNotificationEvent(Object, UnsolicitedNotification)'</p>
 * <p>This is the constructor method that constructs a new instance of UnsolicitedNotificationEvent. In this case we are sending 
 * one null arguments. This is not specified in the API.</p>
 * <p>The expected result is an Illegal Argument exception.</p>
 */
public void testUnsolicitedNotificationEvent003() {
       try {
           MockUnsolicitedNotification u = new MockUnsolicitedNotification();
           new UnsolicitedNotificationEvent(null, u);
           fail("The arguments could not be null.");
       } catch (IllegalArgumentException e) {}
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.getNotification()'</p>
 * <p>Here we are testing if the method returns the unsolicited notification. In this case we create a notification
 * with an object and a null notification as the parameters.</p>
 * <p>The expected result is a not null notification.</p>
 */
public void testGetNotification001() {
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(
               new Object(), null);

       assertNull(une.getNotification());
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.getNotification()'</p>
 * <p>Here we are testing if the method returns the unsolicited notification. In this case we create a notification
 * with an object and a null notification as the parameters.</p>
 * <p>The expected result is a not null notification.</p>
 */
public void testGetNotification002() {
       Object x = new Object();
       MockUnsolicitedNotification u = new MockUnsolicitedNotification();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x, u);
       assertEquals(u, une.getNotification());
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.dispatch(UnsolicitedNotificationListener)'</p>
 * <p>Here this method invokes the notificationReceived() method on a listener using this event. In this case we are 
 * sending as a parameter a null listener.</p>
 * <p>The expected result is a null pointer exception.</p>
 */
public void testDispatch001() {
       Object x = new Object();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x,
               new MockUnsolicitedNotification());
       try {
           une.dispatch(null);
           fail("Failed notification is null.");
       } catch (NullPointerException e) {}
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.dispatch(UnsolicitedNotificationListener)'</p>
 * <p>Here this method invokes the notificationReceived() method on a listener using this event. In this case we are 
 * sending as a parameter a non null listener.</p>
 * <p>The expected result is a null pointer exception.</p>
 */
public void testDispatch002() {
       Object x = new Object();
       MockUnsolicitedNotification u = new MockUnsolicitedNotification();
       MockUnsolicitedNotification f = new MockUnsolicitedNotification();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x, u);
       une.dispatch(f);
       assertTrue(f.getFlag());
   }
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_src_null() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = null;
    try {
        new UnsolicitedNotificationEvent(
                src, notification);
    } catch (IllegalArgumentException e) {
    }
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testConstructor_notification_null() {
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, null);

    assertEquals(src, event.getSource());
    assertNull(event.getNotification());
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void testDispatch() {
    NamingException exception = new NamingException(
            "MockUnsolicitedNotification: naming exception");
    String[] referral = { "Red", "Blue", };
    UnsolicitedNotification notification = new MockUnsolicitedNotification(
            referral, exception);
    Object src = "source";
    UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
            src, notification);
    MockUnsolicitedNotificationListener listener = new MockUnsolicitedNotificationListener();
    event.dispatch(listener);
    assertTrue(listener.hasEvent(event));
}
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.UnsolicitedNotificationEvent(Object, UnsolicitedNotification)'</p>
 * <p>This is the constructor method that constructs a new instance of UnsolicitedNotificationEvent. In this case we are sending 
 * two null arguments. This is not specified in the API.</p>
 * <p>The expected result is an Illegal argument exception.</p>
 */
public void testUnsolicitedNotificationEvent001() {
       new UnsolicitedNotificationEvent(new Object(), null);

       try {
           new UnsolicitedNotificationEvent(null, null);
           fail("The arguments could not be null.");
       } catch (IllegalArgumentException e) {}
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.UnsolicitedNotificationEvent(Object, UnsolicitedNotification)'</p>
 * <p>This is the constructor method that constructs a new instance of UnsolicitedNotificationEvent. In this case we are sending 
 * one null arguments. This is not specified in the API.</p>
 * <p>The expected result is an Illegal Argument exception.</p>
 */
public void testUnsolicitedNotificationEvent003() {
       try {
           MockUnsolicitedNotification u = new MockUnsolicitedNotification();
           new UnsolicitedNotificationEvent(null, u);
           fail("The arguments could not be null.");
       } catch (IllegalArgumentException e) {}
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.getNotification()'</p>
 * <p>Here we are testing if the method returns the unsolicited notification. In this case we create a notification
 * with an object and a null notification as the parameters.</p>
 * <p>The expected result is a not null notification.</p>
 */
public void testGetNotification001() {
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(
               new Object(), null);

       assertNull(une.getNotification());
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.getNotification()'</p>
 * <p>Here we are testing if the method returns the unsolicited notification. In this case we create a notification
 * with an object and a null notification as the parameters.</p>
 * <p>The expected result is a not null notification.</p>
 */
public void testGetNotification002() {
       Object x = new Object();
       MockUnsolicitedNotification u = new MockUnsolicitedNotification();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x, u);
       assertEquals(u, une.getNotification());
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.dispatch(UnsolicitedNotificationListener)'</p>
 * <p>Here this method invokes the notificationReceived() method on a listener using this event. In this case we are 
 * sending as a parameter a null listener.</p>
 * <p>The expected result is a null pointer exception.</p>
 */
public void testDispatch001() {
       Object x = new Object();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x,
               new MockUnsolicitedNotification());
       try {
           une.dispatch(null);
           fail("Failed notification is null.");
       } catch (NullPointerException e) {}
   }
项目:freeVM    文件:TestUnsolicitedNotificationEvent.java   
/**
 * <p>Test method for 'javax.naming.ldap.UnsolicitedNotificationEvent.dispatch(UnsolicitedNotificationListener)'</p>
 * <p>Here this method invokes the notificationReceived() method on a listener using this event. In this case we are 
 * sending as a parameter a non null listener.</p>
 * <p>The expected result is a null pointer exception.</p>
 */
public void testDispatch002() {
       Object x = new Object();
       MockUnsolicitedNotification u = new MockUnsolicitedNotification();
       MockUnsolicitedNotification f = new MockUnsolicitedNotification();
       UnsolicitedNotificationEvent une = new UnsolicitedNotificationEvent(x, u);
       une.dispatch(f);
       assertTrue(f.getFlag());
   }
项目:cn1    文件:MockUnsolicitedNotification.java   
/**
 * <p>Here we received the notification, so we set the flag true.</p>
 */
public void notificationReceived(UnsolicitedNotificationEvent arg0) {
    flag=true;

}
项目:cn1    文件:UnsolicitedNotificationEventTest.java   
public MockUnsolicitedNotificationListener() {
    events = new Vector<UnsolicitedNotificationEvent>();
}
项目:cn1    文件:UnsolicitedNotificationEventTest.java   
public void notificationReceived(UnsolicitedNotificationEvent e) {
    this.events.add(e);
}
项目:cn1    文件:UnsolicitedNotificationEventTest.java   
public boolean hasEvent(UnsolicitedNotificationEvent e) {
    return this.events.contains(e);
}
项目:cn1    文件:LdapContextServerMockedTest.java   
public void notificationReceived(UnsolicitedNotificationEvent e) {
    unsolicatedEvent = e;
}
项目:freeVM    文件:MockUnsolicitedNotification.java   
/**
 * <p>Here we recived the notification, so we set the flag true.</p>
 */
public void notificationReceived(UnsolicitedNotificationEvent arg0) {
    flag=true;

}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public MockUnsolicitedNotificationListener() {
    events = new Vector<UnsolicitedNotificationEvent>();
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public void notificationReceived(UnsolicitedNotificationEvent e) {
    this.events.add(e);
}
项目:freeVM    文件:UnsolicitedNotificationEventTest.java   
public boolean hasEvent(UnsolicitedNotificationEvent e) {
    return this.events.contains(e);
}
项目:freeVM    文件:MockUnsolicitedNotification.java   
/**
 * <p>Here we received the notification, so we set the flag true.</p>
 */
public void notificationReceived(UnsolicitedNotificationEvent arg0) {
    flag=true;

}