本文整理汇总了Java中java.beans.beancontext.BeanContextServiceRevokedEvent类的典型用法代码示例。如果您正苦于以下问题:Java BeanContextServiceRevokedEvent类的具体用法?Java BeanContextServiceRevokedEvent怎么用?Java BeanContextServiceRevokedEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BeanContextServiceRevokedEvent类属于java.beans.beancontext包,在下文中一共展示了BeanContextServiceRevokedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertEqualsSerially
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
private void assertEqualsSerially(BeanContextServiceRevokedEvent orig,
BeanContextServiceRevokedEvent ser) {
assertNull(ser.getSource());
// check propagatedFrom
if (orig.getPropagatedFrom() instanceof Serializable) {
BeanContext origFrom = orig.getPropagatedFrom();
BeanContext serFrom = ser.getPropagatedFrom();
assertEquals(origFrom.getClass(), serFrom.getClass());
if (origFrom instanceof MockBeanContextDelegateS) {
assertEquals(((MockBeanContextDelegateS) origFrom).id,
((MockBeanContextDelegateS) serFrom).id);
}
}
// check serviceClass
assertEquals(orig.getServiceClass(), ser.getServiceClass());
// check invalidateRefs
assertEquals(orig.isCurrentServiceInvalidNow(), ser
.isCurrentServiceInvalidNow());
}
示例2: testFireServiceRevokedBeanContextServiceRevokedEvent
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testFireServiceRevokedBeanContextServiceRevokedEvent() {
MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
MockBeanContextServicesSupport childSupport = new MockBeanContextServicesSupport();
support.add(childSupport);
MockBeanContextServicesListener l1 = new MockBeanContextServicesListener();
MockBeanContextServicesListener l2 = new MockBeanContextServicesListener();
support.addBeanContextServicesListener(l1);
childSupport.addBeanContextServicesListener(l2);
support.records.assertRecord("initialize", null);
childSupport.records.assertRecord("initialize", null);
BeanContextServiceRevokedEvent evt = new BeanContextServiceRevokedEvent(
support, Collection.class, false);
support.publicFireServiceRevoked(evt);
support.records.assertEndOfRecords();
childSupport.records.assertEndOfRecords();
assertSame(evt, l1.lastRevokedEvent);
assertNull(l2.lastRevokedEvent);
}
示例3: test_serviceRevoked_LBeanContextServiceRevokedEvent
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void test_serviceRevoked_LBeanContextServiceRevokedEvent() {
BeanContextServicesSupport support = new BeanContextServicesSupport();
support.add(new MySupport());
support.addBeanContextServicesListener(new MyListener());
Class c = Object.class;
support.addService(c, new MyProvider());
BeanContextServiceRevokedEvent revokeEvent = new BeanContextServiceRevokedEvent(
support, c, false);
support.serviceRevoked(revokeEvent);
assertEquals(0, serviceRevoked);
assertEquals(2, serviceAvailable);
}
示例4: testBeanContextServiceRevokedEvent
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testBeanContextServiceRevokedEvent() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertSame(BeanContext.class, event.getServiceClass());
assertSame(services, event.getSource());
assertSame(services, event.getSourceAsBeanContextServices());
assertTrue(event.isCurrentServiceInvalidNow());
}
示例5: testIsServiceClass
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testIsServiceClass() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertTrue(event.isServiceClass(BeanContext.class));
assertFalse(event.isServiceClass(Integer.class));
// Regression for HARMONY-1516
assertFalse(event.isServiceClass(null));
}
示例6: testIsCurrentServiceInvalidNow
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testIsCurrentServiceInvalidNow() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertTrue(event.isCurrentServiceInvalidNow());
event = new MockBeanContextServiceRevokedEvent(services,
BeanContext.class, false);
assertFalse(event.isCurrentServiceInvalidNow());
}
示例7: testSerialization
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testSerialization() throws IOException, ClassNotFoundException {
BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
new MockBeanContextServices(), ArrayList.class, true);
event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
assertEqualsSerially(event,
(BeanContextServiceRevokedEvent) SerializationTester
.getDeserilizedObject(event));
}
示例8: testSerialization_Compatibility
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testSerialization_Compatibility() throws Exception {
BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
new MockBeanContextServices(), ArrayList.class, true);
event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
SerializationTest.verifyGolden(this, event, new SerializableAssert() {
public void assertDeserialized(Serializable orig, Serializable ser) {
assertEqualsSerially((BeanContextServiceRevokedEvent) orig,
(BeanContextServiceRevokedEvent) ser);
}
});
}
示例9: testConstructor
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testConstructor() throws Exception {
BeanContextServices bcs = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
bcs, ArrayList.class, true);
assertEquals(null, event.getPropagatedFrom());
assertEquals(ArrayList.class, event.getServiceClass());
assertSame(bcs, event.getSource());
assertSame(bcs, event.getBeanContext());
assertSame(bcs, event.getSourceAsBeanContextServices());
assertFalse(event.isPropagated());
}
示例10: testServiceRevoked
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testServiceRevoked() {
MockChildBeanContextServicesSupport mockChildBeanContextServicesSupport = new MockChildBeanContextServicesSupport();
BeanContextServicesSupport beanContextServicesSupport = new BeanContextServicesSupport();
beanContextServicesSupport.add(mockChildBeanContextServicesSupport);
BeanContextServiceRevokedEvent beanContextServiceRevokedEvent = new BeanContextServiceRevokedEvent(new BeanContextServicesSupport(), Collection.class,false);
beanContextServicesSupport.serviceRevoked(beanContextServiceRevokedEvent);
assertTrue(mockChildBeanContextServicesSupport.revokeCalled);
}
示例11: testSerialization
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testSerialization() throws IOException, ClassNotFoundException {
BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
new MockBeanContextServices(), ArrayList.class, true);
event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
assertEqualsSerially(event,
(BeanContextServiceRevokedEvent) SerializationTester
.getDeserilizedObject(event));
}
示例12: testSerialization_Compatibility
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testSerialization_Compatibility() throws Exception {
BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
new MockBeanContextServices(), ArrayList.class, true);
event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
assertEqualsSerially(
event,
(BeanContextServiceRevokedEvent) SerializationTester
.readObject(event,
"serialization/java/beans/beancontext/BeanContextServiceRevokedEvent.ser"));
}
示例13: serviceRevoked
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
/**
* @param bcsre the BeanContextServiceRevokedEvent
*/
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {
System.out.println("Sservice is revoked");
counterRevokedEvent++;
this.bcsre = bcsre;
}
示例14: serviceRevoked
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void serviceRevoked(BeanContextServiceRevokedEvent p0) {
return;
}
示例15: testGetServiceClass
import java.beans.beancontext.BeanContextServiceRevokedEvent; //导入依赖的package包/类
public void testGetServiceClass() {
BeanContextServices services = new MockBeanContextServices();
BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
services, BeanContext.class, true);
assertSame(BeanContext.class, event.getServiceClass());
}