Java 类java.beans.beancontext.BeanContextServiceRevokedEvent 实例源码

项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
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);
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
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);

}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:freeVM    文件:BeanContextServicesSupportTest.java   
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);
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:freeVM    文件:BeanContextServicesSupportTest.java   
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);
}
项目:freeVM    文件:BeanContextServicesSupportTest.java   
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);

}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
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));
}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
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));

}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
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);
        }
    });
}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
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);        
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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));
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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));
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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"));
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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));
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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));

}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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);
        }
    });
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
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());
}
项目:freeVM    文件:BeanContextServicesSupportTest.java   
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);        
}
项目:freeVM    文件:ServiceBean.java   
/**
 * @param bcsre the BeanContextServiceRevokedEvent
 */
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {

    System.out.println("Sservice is revoked");
    counterRevokedEvent++;
    this.bcsre = bcsre;
}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
public void serviceRevoked(BeanContextServiceRevokedEvent p0) {
    return;
}
项目:cn1    文件:BeanContextServiceRevokedEventTest.java   
public void testGetServiceClass() {
    BeanContextServices services = new MockBeanContextServices();
    BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
            services, BeanContext.class, true);
    assertSame(BeanContext.class, event.getServiceClass());
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
public void publicFireServiceRevoked(BeanContextServiceRevokedEvent evt) {
    fireServiceRevoked(evt);
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
@Override
public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) {
    super.serviceRevoked(bcssre);
    records.add("serviceRevoked", bcssre, null);
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) {
    revokeCalled = true;
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
public void serviceRevoked(BeanContextServiceRevokedEvent event) {
    serviceRevoked++;
}
项目:cn1    文件:BeanContextServicesSupportTest.java   
public void serviceRevoked(BeanContextServiceRevokedEvent event) {
    serviceRevoked++;
}
项目:cn1    文件:MockBeanContextDelegateS.java   
public void serviceRevoked(BeanContextServiceRevokedEvent arg0) {
    support.serviceRevoked(arg0);
}
项目:cn1    文件:MockBeanContextServicesListener.java   
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {
    lastRevokedEvent = bcsre;
}
项目:cn1    文件:MockBeanContextServiceRevokedListener.java   
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {
    lastEvent = bcsre;
}
项目:freeVM    文件:BeanContextServiceRevokedEventTest.java   
public void testGetServiceClass() {
    BeanContextServices services = new MockBeanContextServices();
    BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
            services, BeanContext.class, true);
    assertSame(BeanContext.class, event.getServiceClass());
}
项目:freeVM    文件:BeanContextServicesSupportTest.java   
public void publicFireServiceRevoked(BeanContextServiceRevokedEvent evt) {
    fireServiceRevoked(evt);
}