[jboss-cvs] JBossAS SVN: r73446 - in projects/microcontainer/trunk/kernel/src: tests/org/jboss/test/kernel/inject/support and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 16 10:07:11 EDT 2008
Author: wolfc
Date: 2008-05-16 10:07:11 -0400 (Fri, 16 May 2008)
New Revision: 73446
Added:
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/SerializableInjectedBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.java
Log:
JBMICROCONT-288: unit test
Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.xml 2008-05-16 14:07:11 UTC (rev 73446)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="testObject1" class="org.jboss.test.kernel.inject.support.SerializableInjectedBean">
+ <!--
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ -->
+ </bean>
+</deployment>
\ No newline at end of file
Property changes on: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.xml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/SerializableInjectedBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/SerializableInjectedBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/SerializableInjectedBean.java 2008-05-16 14:07:11 UTC (rev 73446)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.kernel.inject.support;
+
+import java.io.Serializable;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.kernel.Kernel;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SerializableInjectedBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private transient Kernel kernel;
+
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ @Inject(bean="jboss.kernel:service=Kernel")
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+}
Property changes on: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/SerializableInjectedBean.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.java 2008-05-16 14:07:11 UTC (rev 73446)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.kernel.inject.test;
+
+import java.rmi.MarshalledObject;
+
+import junit.framework.Test;
+
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.inject.support.SerializableInjectedBean;
+
+/**
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SerializableInjectedBeanTestCase extends AbstractManualInjectTest
+{
+ public SerializableInjectedBeanTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(SerializableInjectedBeanTestCase.class);
+ }
+
+ public void testInjectionValueMetaData() throws Throwable
+ {
+ KernelControllerContext context = getControllerContext("testObject1", ControllerState.NOT_INSTALLED);
+ assertNull(context.getTarget());
+ assertEquals(context.getState(), ControllerState.NOT_INSTALLED);
+
+ change(context, ControllerState.INSTALLED);
+ SerializableInjectedBean injectee = (SerializableInjectedBean)context.getTarget();
+ assertNotNull(injectee);
+ assertNotNull(injectee.getKernel());
+
+ MarshalledObject<SerializableInjectedBean> mo = new MarshalledObject<SerializableInjectedBean>(injectee);
+ SerializableInjectedBean unmarshalled = mo.get();
+
+ assertNotNull(unmarshalled);
+ assertNotNull("kernel property is not set", unmarshalled.getKernel());
+ }
+
+}
Property changes on: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/SerializableInjectedBeanTestCase.java
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list