本文整理汇总了Java中javax.naming.ldap.UnsolicitedNotificationEvent类的典型用法代码示例。如果您正苦于以下问题:Java UnsolicitedNotificationEvent类的具体用法?Java UnsolicitedNotificationEvent怎么用?Java UnsolicitedNotificationEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnsolicitedNotificationEvent类属于javax.naming.ldap包,在下文中一共展示了UnsolicitedNotificationEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConstructor_simple
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
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());
}
示例2: testConstructor_src_null
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
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) {
}
}
示例3: testConstructor_notification_null
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
public void testConstructor_notification_null() {
Object src = "source";
UnsolicitedNotificationEvent event = new UnsolicitedNotificationEvent(
src, null);
assertEquals(src, event.getSource());
assertNull(event.getNotification());
}
示例4: testDispatch
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
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));
}
示例5: testUnsolicitedNotificationEvent001
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
/**
* <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) {}
}
示例6: testUnsolicitedNotificationEvent003
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
/**
* <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) {}
}
示例7: testGetNotification001
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
/**
* <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());
}
示例8: testGetNotification002
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
/**
* <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());
}
示例9: testDispatch001
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
/**
* <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) {}
}
示例10: testDispatch002
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
/**
* <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());
}
示例11: notificationReceived
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
/**
* <p>Here we received the notification, so we set the flag true.</p>
*/
public void notificationReceived(UnsolicitedNotificationEvent arg0) {
flag=true;
}
示例12: MockUnsolicitedNotificationListener
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
public MockUnsolicitedNotificationListener() {
events = new Vector<UnsolicitedNotificationEvent>();
}
示例13: notificationReceived
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
public void notificationReceived(UnsolicitedNotificationEvent e) {
this.events.add(e);
}
示例14: hasEvent
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
public boolean hasEvent(UnsolicitedNotificationEvent e) {
return this.events.contains(e);
}
示例15: notificationReceived
import javax.naming.ldap.UnsolicitedNotificationEvent; //导入依赖的package包/类
public void notificationReceived(UnsolicitedNotificationEvent e) {
unsolicatedEvent = e;
}