当前位置: 首页>>代码示例>>Java>>正文


Java BeanContextEvent.setPropagatedFrom方法代码示例

本文整理汇总了Java中java.beans.beancontext.BeanContextEvent.setPropagatedFrom方法的典型用法代码示例。如果您正苦于以下问题:Java BeanContextEvent.setPropagatedFrom方法的具体用法?Java BeanContextEvent.setPropagatedFrom怎么用?Java BeanContextEvent.setPropagatedFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.beans.beancontext.BeanContextEvent的用法示例。


在下文中一共展示了BeanContextEvent.setPropagatedFrom方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSerialization

import java.beans.beancontext.BeanContextEvent; //导入方法依赖的package包/类
public void testSerialization() throws Exception {
    final BeanContextServicesSupport ctx = new BeanContextServicesSupport(
            null, Locale.FRANCE, false, false);
    final BeanContextServicesSupport ctx2 = new BeanContextServicesSupport(
            ctx, Locale.ITALY, true, true);
    BeanContextEvent event = new MockBeanContextEvent(ctx2);
    event.setPropagatedFrom(ctx);
    SerializationTest.verifySelf(event, new SerializableAssert(){
        public void assertDeserialized(Serializable arg0, Serializable arg1) {
            BeanContextEvent e1 = (BeanContextEvent)arg0;
            BeanContextEvent e2 = (BeanContextEvent)arg1;
            assertNull((BeanContextServicesSupport)e2.getSource());
            assertNotNull((BeanContextServicesSupport)e1.getSource());
            assertEqualsSerially((BeanContextServicesSupport)e1.getPropagatedFrom(), (BeanContextServicesSupport)e2.getPropagatedFrom());
            assertEqualsSerially(ctx, (BeanContextServicesSupport)e2.getPropagatedFrom());
        }
    });
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:BeanContextEventTest.java

示例2: testSerializationComptibility

import java.beans.beancontext.BeanContextEvent; //导入方法依赖的package包/类
public void testSerializationComptibility() throws Exception {
    final BeanContextServicesSupport ctx = new BeanContextServicesSupport(
            null, Locale.ITALY, true, true);
    final BeanContextServicesSupport ctx2 = new BeanContextServicesSupport(
            null, Locale.CHINA, true, true);
    
    BeanContextEvent event = new MockBeanContextEvent(ctx);
    event.setPropagatedFrom(ctx2);
    SerializationTest.verifyGolden(this, event, new SerializableAssert(){
        public void assertDeserialized(Serializable arg0, Serializable arg1) {
            BeanContextEvent e1 = (BeanContextEvent)arg0;
            BeanContextEvent e2 = (BeanContextEvent)arg1;
            assertNull((BeanContextServicesSupport)e2.getSource());
            assertNotNull((BeanContextServicesSupport)e1.getSource());
            assertEqualsSerially((BeanContextServicesSupport)e1.getPropagatedFrom(), (BeanContextServicesSupport)e2.getPropagatedFrom());
            assertEqualsSerially(ctx2, (BeanContextServicesSupport)e2.getPropagatedFrom());
        }
    });
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:BeanContextEventTest.java

示例3: testGetPropagatedFrom

import java.beans.beancontext.BeanContextEvent; //导入方法依赖的package包/类
public void testGetPropagatedFrom() {
    BeanContext ctx = new MockBeanContext();
    BeanContextEvent event = new MockBeanContextEvent(ctx);
    assertNull(event.getPropagatedFrom());

    BeanContext ctx2 = new MockBeanContext();
    event.setPropagatedFrom(ctx2);
    assertSame(ctx2, event.getPropagatedFrom());

    event.setPropagatedFrom(ctx);
    assertSame(ctx, event.getPropagatedFrom());

    event.setPropagatedFrom(null);
    assertNull(event.getPropagatedFrom());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:BeanContextEventTest.java

示例4: testIsPropagated

import java.beans.beancontext.BeanContextEvent; //导入方法依赖的package包/类
public void testIsPropagated() {
    BeanContext ctx = new MockBeanContext();
    BeanContextEvent event = new MockBeanContextEvent(ctx);
    assertFalse(event.isPropagated());

    BeanContext ctx2 = new MockBeanContext();
    event.setPropagatedFrom(ctx2);
    assertTrue(event.isPropagated());

    event.setPropagatedFrom(ctx);
    assertTrue(event.isPropagated());

    event.setPropagatedFrom(null);
    assertFalse(event.isPropagated());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:BeanContextEventTest.java

示例5: testSetPropagatedFrom

import java.beans.beancontext.BeanContextEvent; //导入方法依赖的package包/类
public void testSetPropagatedFrom() {
    BeanContext ctx = new MockBeanContext();
    BeanContextEvent event = new MockBeanContextEvent(ctx);
    assertNull(event.getPropagatedFrom());

    BeanContext ctx2 = new MockBeanContext();
    event.setPropagatedFrom(ctx2);
    assertSame(ctx2, event.getPropagatedFrom());

    event.setPropagatedFrom(ctx);
    assertSame(ctx, event.getPropagatedFrom());

    event.setPropagatedFrom(null);
    assertNull(event.getPropagatedFrom());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:BeanContextEventTest.java


注:本文中的java.beans.beancontext.BeanContextEvent.setPropagatedFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。