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()); }
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); }
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); }
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()); }
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)); }
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()); }
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)); }
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); } }); }
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()); }
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); }
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")); }
/** * @param bcsre the BeanContextServiceRevokedEvent */ public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { System.out.println("Sservice is revoked"); counterRevokedEvent++; this.bcsre = bcsre; }
public void serviceRevoked(BeanContextServiceRevokedEvent p0) { return; }
public void testGetServiceClass() { BeanContextServices services = new MockBeanContextServices(); BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent( services, BeanContext.class, true); assertSame(BeanContext.class, event.getServiceClass()); }
public void publicFireServiceRevoked(BeanContextServiceRevokedEvent evt) { fireServiceRevoked(evt); }
@Override public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) { super.serviceRevoked(bcssre); records.add("serviceRevoked", bcssre, null); }
public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) { revokeCalled = true; }
public void serviceRevoked(BeanContextServiceRevokedEvent event) { serviceRevoked++; }
public void serviceRevoked(BeanContextServiceRevokedEvent arg0) { support.serviceRevoked(arg0); }
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { lastRevokedEvent = bcsre; }
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { lastEvent = bcsre; }