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());
}
});
}
java类java.beans.beancontext.BeanContextServicesSupport的实例源码
BeanContextEventTest.java 文件源码
项目:cn1
阅读 21
收藏 0
点赞 0
评论 0
BeanContextEventTest.java 文件源码
项目:cn1
阅读 25
收藏 0
点赞 0
评论 0
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());
}
});
}
BeanContextServicesSupportTest.java 文件源码
项目:cn1
阅读 22
收藏 0
点赞 0
评论 0
public void testSerialization() throws IOException, ClassNotFoundException {
BeanContextServicesSupport support = new BeanContextServicesSupport(
null, Locale.ITALY, true, true);
support
.addBeanContextServicesListener(new MockBeanContextServicesListener());
support
.addBeanContextServicesListener(new MockBeanContextServicesListenerS(
"l2"));
support
.addBeanContextServicesListener(new MockBeanContextServicesListenerS(
"l3"));
support
.addBeanContextServicesListener(new MockBeanContextServicesListener());
support.addService(Collection.class,
new MockBeanContextServiceProvider());
support.addService(List.class,
new MockBeanContextServiceProviderS("p1"));
support
.addService(Set.class,
new MockBeanContextServiceProviderS("p2"));
support.addService(Map.class, new MockBeanContextServiceProvider());
assertEqualsSerially(support,
(BeanContextServicesSupport) SerializationTester
.getDeserilizedObject(support));
}
BeanContextServicesSupportTest.java 文件源码
项目:cn1
阅读 24
收藏 0
点赞 0
评论 0
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);
}
BeanContextServicesSupportTest.java 文件源码
项目:cn1
阅读 21
收藏 0
点赞 0
评论 0
public void test_serviceAvailable_LBeanContextServiceRevokedEvent() {
BeanContextServicesSupport support = new BeanContextServicesSupport();
support.add(new MySupport());
support.addBeanContextServicesListener(new MyListener());
Class c = Object.class;
support.addService(c, new MyProvider());
BeanContextServiceAvailableEvent availableEvent = new BeanContextServiceAvailableEvent(
support, c);
support.serviceAvailable(availableEvent);
assertEquals(0, serviceRevoked);
assertEquals(2, serviceAvailable);
}
BeanContextServicesSupportTest.java 文件源码
项目:freeVM
阅读 26
收藏 0
点赞 0
评论 0
public void testSerialization() throws IOException, ClassNotFoundException {
BeanContextServicesSupport support = new BeanContextServicesSupport(
null, Locale.ITALY, true, true);
support
.addBeanContextServicesListener(new MockBeanContextServicesListener());
support
.addBeanContextServicesListener(new MockBeanContextServicesListenerS(
"l2"));
support
.addBeanContextServicesListener(new MockBeanContextServicesListenerS(
"l3"));
support
.addBeanContextServicesListener(new MockBeanContextServicesListener());
support.addService(Collection.class,
new MockBeanContextServiceProvider());
support.addService(List.class,
new MockBeanContextServiceProviderS("p1"));
support
.addService(Set.class,
new MockBeanContextServiceProviderS("p2"));
support.addService(Map.class, new MockBeanContextServiceProvider());
assertEqualsSerially(support,
(BeanContextServicesSupport) SerializationTester
.getDeserilizedObject(support));
}
BeanContextEventTest.java 文件源码
项目:freeVM
阅读 20
收藏 0
点赞 0
评论 0
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());
}
});
}
BeanContextEventTest.java 文件源码
项目:freeVM
阅读 27
收藏 0
点赞 0
评论 0
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());
}
});
}
BeanContextServicesSupportTest.java 文件源码
项目:freeVM
阅读 26
收藏 0
点赞 0
评论 0
public void testSerialization() throws IOException, ClassNotFoundException {
BeanContextServicesSupport support = new BeanContextServicesSupport(
null, Locale.ITALY, true, true);
support
.addBeanContextServicesListener(new MockBeanContextServicesListener());
support
.addBeanContextServicesListener(new MockBeanContextServicesListenerS(
"l2"));
support
.addBeanContextServicesListener(new MockBeanContextServicesListenerS(
"l3"));
support
.addBeanContextServicesListener(new MockBeanContextServicesListener());
support.addService(Collection.class,
new MockBeanContextServiceProvider());
support.addService(List.class,
new MockBeanContextServiceProviderS("p1"));
support
.addService(Set.class,
new MockBeanContextServiceProviderS("p2"));
support.addService(Map.class, new MockBeanContextServiceProvider());
assertEqualsSerially(support,
(BeanContextServicesSupport) SerializationTester
.getDeserilizedObject(support));
}
BeanContextServicesSupportTest.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
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);
}
BeanContextServicesSupportTest.java 文件源码
项目:freeVM
阅读 21
收藏 0
点赞 0
评论 0
public void test_serviceAvailable_LBeanContextServiceRevokedEvent() {
BeanContextServicesSupport support = new BeanContextServicesSupport();
support.add(new MySupport());
support.addBeanContextServicesListener(new MyListener());
Class c = Object.class;
support.addService(c, new MyProvider());
BeanContextServiceAvailableEvent availableEvent = new BeanContextServiceAvailableEvent(
support, c);
support.serviceAvailable(availableEvent);
assertEquals(0, serviceRevoked);
assertEquals(2, serviceAvailable);
}
TestBeanContextServicesSupport.java 文件源码
项目:freeVM
阅读 39
收藏 0
点赞 0
评论 0
/**
* @see java.beans.beancontext.BeanContextServicesSupport#getBeanContextServicesPeer()
*/
public Result testGetBeanContextServicesPeer() throws Exception {
context = new BeanContextServicesSupport();
serviceBean = new ServiceBean();
// Adding the component
context.add(serviceBean);
// Add service to the context
if ((context.getBeanContextServicesPeer() instanceof BeanContextServicesSupport))
return passed();
else
return failed("method testGetBeanContextServicesPeer");
}
TestBeanContextServicesSupport.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
/**
* @see java.beans.beancontext.BeanContextServicesSupport#getCurrentServiceSelectors()
*/
public Result testGetCurrentServiceSelectors() throws Exception {
context = new BeanContextServicesSupport();
serviceBean = new ServiceBean();
// Adding the component
context.add(serviceBean);
// Listen for new services
context.addBeanContextServicesListener(serviceBean);
TestServiceProvider provider = new TestServiceProvider();
// Add service to the context
context.addService(TestCounter.class, provider);
if ((context.getCurrentServiceSelectors(TestCounter.class) instanceof Iterator))
return passed();
else
return failed("method testGetCurrentServiceSelectors");
}
TestBeanContextServicesSupport.java 文件源码
项目:freeVM
阅读 24
收藏 0
点赞 0
评论 0
/**
* @see java.beans.beancontext.BeanContextServicesSupport#getService()
*/
public Result testGetService() throws Exception {
context = new BeanContextServicesSupport();
serviceBean = new ServiceBean();
// Adding the component
context.add(serviceBean);
// Listen for new services
context.addBeanContextServicesListener(serviceBean);
TestServiceProvider provider = new TestServiceProvider();
// Add service to the context
context.addService(TestCounter.class, provider);
if ((serviceBean.service instanceof TestCounter))
return passed();
else
return failed("method testGetService");
}
TestBeanContextServicesSupportException.java 文件源码
项目:freeVM
阅读 22
收藏 0
点赞 0
评论 0
/**
* @see java.beans.beancontext.BeanContextServicesSupport#addBeanContextServicesListener()
*/
public Result testAddBeanContextServicesListenerException()
throws Exception {
context = new BeanContextServicesSupport();
serviceBean = null;
try {
// Listen for new service
context.addBeanContextServicesListener(serviceBean);
} catch (NullPointerException e) {
return passed();
}
return failed("testAddBeanContextServicesListenerException");
}
TestBeanContextServicesSupportException.java 文件源码
项目:freeVM
阅读 19
收藏 0
点赞 0
评论 0
/**
* @see java.beans.beancontext.BeanContextServicesSupport#getService()
*/
public Result testGetServiceException() throws Exception {
BeanContextChild child = null;
Object requestor = null;
Class serviceClass = null;
Object serviceSelector = null;
BeanContextServiceRevokedListener bcsrl = null;
BeanContextServicesSupport context = new BeanContextServicesSupport();
serviceBean = null;
try {
context.getService(child, requestor ,serviceClass,serviceSelector,bcsrl);
} catch (NullPointerException e) {
return passed();
}
return failed("testGetServiceException");
}
TestBeanContextServicesSupportException.java 文件源码
项目:freeVM
阅读 19
收藏 0
点赞 0
评论 0
/**
* @see java.beans.beancontext.BeanContextServicesSupport#releaseService()
*/
public Result testReleaseServiceException() throws Exception {
BeanContextChild child = null;
Object requestor = null;
Object service = null;
BeanContextServicesSupport context = new BeanContextServicesSupport();
serviceBean = null;
try {
context.releaseService(child, requestor ,service);
} catch (NullPointerException e) {
return passed();
}
return failed("testGetServiceException");
}
TestBeanContextServiceAvailableEvent.java 文件源码
项目:freeVM
阅读 17
收藏 0
点赞 0
评论 0
/**
* @see java.beans.beancontext.BeanContextServiceAvailableEvent#getCurrentServiceSelectors()
* @see java.beans.beancontext.BeanContextServicesSupport#hasService()
*/
public Result testGetCurrentServiceSelectors() throws Exception {
context = new BeanContextServicesSupport();
serviceBean = new ServiceBean();
// Add service to the context
context.add(serviceBean);
// Listen for new services
context.addBeanContextServicesListener(serviceBean);
TestServiceProvider provider = new TestServiceProvider();
// Add service to the context
context.addService(TestCounter.class, provider);
if ((context.hasService(TestCounter.class))
|| (serviceBean.bcsae.getCurrentServiceSelectors() instanceof java.util.Iterator))
return passed();
else
return failed("method getCurrentServiceSelectors");
}
Test4328406.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
protected void initializeBeanContextResources() {
super.initializeBeanContextResources();
BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
try {
bcs.getService(this, this, MyService1.class, null, this);
}
catch (Exception exception) {
exception.printStackTrace();
}
bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
protected void initializeBeanContextResources() {
super.initializeBeanContextResources();
BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
try {
bcs.getService(this, this, MyService1.class, null, this);
}
catch (Exception exception) {
exception.printStackTrace();
}
bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码
项目:openjdk9
阅读 22
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:openjdk9
阅读 32
收藏 0
点赞 0
评论 0
protected void initializeBeanContextResources() {
super.initializeBeanContextResources();
BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
try {
bcs.getService(this, this, MyService1.class, null, this);
}
catch (Exception exception) {
exception.printStackTrace();
}
bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码
项目:jdk8u_jdk
阅读 20
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:jdk8u_jdk
阅读 21
收藏 0
点赞 0
评论 0
protected void initializeBeanContextResources() {
super.initializeBeanContextResources();
BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
try {
bcs.getService(this, this, MyService1.class, null, this);
}
catch (Exception exception) {
exception.printStackTrace();
}
bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 33
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 20
收藏 0
点赞 0
评论 0
protected void initializeBeanContextResources() {
super.initializeBeanContextResources();
BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
try {
bcs.getService(this, this, MyService1.class, null, this);
}
catch (Exception exception) {
exception.printStackTrace();
}
bcs.addService(this.getClass(), this);
}
Test4328406.java 文件源码
项目:infobip-open-jdk-8
阅读 23
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
BeanContextServices container = new BeanContextServicesSupport();
BeanContextChild ms1 = new MyService1();
BeanContextServices ms2 = new MyService2();
BeanContextChild mb = new MyBean();
container.add(ms1);
container.add(ms2);
ms2.add(mb);
// exception thrown here
container.remove(ms2);
}
}
Test4328406.java 文件源码
项目:infobip-open-jdk-8
阅读 20
收藏 0
点赞 0
评论 0
protected void initializeBeanContextResources() {
super.initializeBeanContextResources();
BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
try {
bcs.getService(this, this, MyService1.class, null, this);
}
catch (Exception exception) {
exception.printStackTrace();
}
bcs.addService(this.getClass(), this);
}