[Design the new POJO MicroContainer] - Re: serializable KernelDeployment
by alesj
"adrian(a)jboss.org" wrote : "alesj" wrote :
| | So if our returned MetaData is non-Serializable, we should throw exception (since we want all our MD to be serializable, right?)?
| |
|
| Correct.
|
Ok, for MetaData there is no problem.
What do we do with JavaBeans (which now fail - since with wildcard test's we use plain java.lang.Object)?
anonymous wrote :
| This is a candidate for AbstractTestCase in the jboss-test project.
|
|
| | /**
| | * Check we have the expected type
| | *
| | * @param <T> the expected type
| | * @param o the object
| | * @param expectedType the excepted class of the exception
| | * @return the expected type
| | */
| | protected <T> T assertInstanceOf(Object o, Class<T> expectedType)
| | {
| | return assertInstanceOf(o, expectedType, true);
| | }
| |
| | /**
| | * Check we have the expected type
| | *
| | * @param <T> the expected type
| | * @param o the object
| | * @param expectedType the excepted class of the exception
| | * @param allowNull whether the object can be null
| | * @return the expected type
| | */
| | protected <T> T assertInstanceOf(Object o, Class<T> expectedType, boolean allowNull)
| | {
| | if (expectedType == null)
| | fail("Null expectedType");
| |
| | if (o == null && allowNull)
| | return null;
| |
| | try
| | {
| | return expectedType.cast(o);
| | }
| | catch (ClassCastException e)
| | {
| | fail("Object " + o + " of class " + o.getClass().getName() + " is not an instanceof " + expectedType.getName());
| | }
| | }
| |
Cool.
I added this code to test project.
Will use it in MC once I update test snapshot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005296#4005296
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005296
19 years, 2 months
[Design of JBoss Web Services] - Re: @PortComponent replacement
by adrian@jboss.org
"heiko.braun(a)jboss.com" wrote : While working on config issues i realized that the PortComponentAnnotation needed refactoring. It's now split into @WebContext and @EndpointConfig.
| The main reason for this was the distinction between client and server side annotations.
|
This change breaks the EJB3 testsuite
| [ejort@warjort ejb3]$ ./build.sh -f build-test.xml
| Buildfile: build-test.xml
| Overriding previous definition of reference to jboss.test.classpath
|
| init:
|
| compile-classes:
| [javac] Compiling 1124 source files to /home/ejort/jboss-head/ejb3/output/test-classes
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree440/model/MyResource.java:12: warning: unmappable character for encoding UTF8
| [javac] * @author Ortwin Gl?
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/jaxws/EndpointEJB.java:36: package org.jboss.ws.annotation does not exist
| [javac] import org.jboss.ws.annotation.PortComponent;
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/jaxws/unit/ContextEJBTestCase.java:37: package org.jboss.ws.metadata.wsdl does not exist
| [javac] import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/jaxws/unit/ContextEJBTestCase.java:38: package org.jboss.ws.tools.wsdl does not exist
| [javac] import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/EJB3Bean.java:25: package org.jboss.ws.annotation does not exist
| [javac] import org.jboss.ws.annotation.PortComponent;
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/EndpointInterface.java:24: package org.jboss.ws.annotation does not exist
| [javac] import org.jboss.ws.annotation.PortComponent;
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java:37: package org.jboss.ws.metadata.wsdl does not exist
| [javac] import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java:38: package org.jboss.ws.tools.wsdl does not exist
| [javac] import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/jaxws/EndpointEJB.java:39: cannot find symbol
| [javac] symbol: class PortComponent
| [javac] @PortComponent(contextRoot = "/jaxws-context", urlPattern = "/*")
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/EJB3Bean.java:38: cannot find symbol
| [javac] symbol: class PortComponent
| [javac] @PortComponent(contextRoot="/jsr181", urlPattern="/*")
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/dd/web/servlets/SubjectFilter.java:76: warning: [deprecation] getActiveSubject() in org.jboss.security.AuthenticationManager has been deprecated
| [javac] Subject s0 = mgr.getActiveSubject();
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/jaxws/unit/ContextEJBTestCase.java:63: cannot find symbol
| [javac] symbol : class WSDLDefinitionsFactory
| [javac] location: class org.jboss.ejb3.test.jaxws.unit.ContextEJBTestCase
| [javac] WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/jaxws/unit/ContextEJBTestCase.java:63: cannot find symbol
| [javac] symbol : variable WSDLDefinitionsFactory
| [javac] location: class org.jboss.ejb3.test.jaxws.unit.ContextEJBTestCase
| [javac] WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/jaxws/unit/ContextEJBTestCase.java:64: cannot find symbol
| [javac] symbol : class WSDLDefinitions
| [javac] location: class org.jboss.ejb3.test.jaxws.unit.ContextEJBTestCase
| [javac] WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/standalone/unit/StandardTestCase.java:167: warning: non-varargs call of varargs method with inexact argument type for last parameter;
| [javac] cast to java.lang.Object for a varargs call
| [javac] cast to java.lang.Object[] for a non-varargs call and to suppress this warning
| [javac] Object testCase = constructor.newInstance(constructorParams);
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/standalone/unit/StandardTestCase.java:192: warning: non-varargs call of varargs method with inexact argument type for last parameter;
| [javac] cast to java.lang.Object for a varargs call
| [javac] cast to java.lang.Object[] for a non-varargs call and to suppress this warning
| [javac] Object testCase = constructor.newInstance(constructorParams);
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java:106: cannot find symbol
| [javac] symbol : class WSDLDefinitionsFactory
| [javac] location: class org.jboss.ejb3.test.webservices.unit.JSR181TestCase
| [javac] WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java:106: cannot find symbol
| [javac] symbol : variable WSDLDefinitionsFactory
| [javac] location: class org.jboss.ejb3.test.webservices.unit.JSR181TestCase
| [javac] WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
| [javac] ^
| [javac] /home/ejort/jboss-head/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java:107: cannot find symbol
| [javac] symbol : class WSDLDefinitions
| [javac] location: class org.jboss.ejb3.test.webservices.unit.JSR181TestCase
| [javac] WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
| [javac] ^
| [javac] Note: Some input files use unchecked or unsafe operations.
| [javac] Note: Recompile with -Xlint:unchecked for details.
| [javac] 15 errors
| [javac] 4 warnings
|
| BUILD FAILED
| /home/ejort/jboss-head/ejb3/build-test.xml:347: Compile failed; see the compiler error output for details.
|
What is it with the webservices team that they can't resist refactoring code
and consequentially continually breaking the JBossAS build? :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005293#4005293
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005293
19 years, 2 months
[Design the new POJO MicroContainer] - Re: serializable KernelDeployment
by adrian@jboss.org
"alesj" wrote :
| So if our returned MetaData is non-Serializable, we should throw exception (since we want all our MD to be serializable, right?)?
|
Correct.
This is a candidate for AbstractTestCase in the jboss-test project.
| /**
| * Check we have the expected type
| *
| * @param <T> the expected type
| * @param o the object
| * @param expectedType the excepted class of the exception
| * @return the expected type
| */
| protected <T> T assertInstanceOf(Object o, Class<T> expectedType)
| {
| return assertInstanceOf(o, expectedType, true);
| }
|
| /**
| * Check we have the expected type
| *
| * @param <T> the expected type
| * @param o the object
| * @param expectedType the excepted class of the exception
| * @param allowNull whether the object can be null
| * @return the expected type
| */
| protected <T> T assertInstanceOf(Object o, Class<T> expectedType, boolean allowNull)
| {
| if (expectedType == null)
| fail("Null expectedType");
|
| if (o == null && allowNull)
| return null;
|
| try
| {
| return expected.cast(o);
| }
| catch (ClassCastException e)
| {
| fail("Object " + o + " of class " + o.getClass().getName() + " is not an instanceof " + expectedType.getName());
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005260#4005260
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005260
19 years, 2 months
[Design the new POJO MicroContainer] - Re: Case sensitivity in injecting a bean's property
by adrian@jboss.org
Ok, so first of all, we need a test for this in system-jmx.
The only test for cross injection just uses the object, it does not test
accessing a "property" of an MBean.
org.jboss.test.system.controller.integration.test.ConfigureMCFromJMXTestCase-mc.xml
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
| <bean name="Test" class="org.jboss.test.system.controller.integration.support.SimpleBean">
| <property name="simple"><inject bean="jboss.test:type=test"/></property>
| </bean>
| </deployment>
|
Previously, this just treated the MBean like a javabean
(i.e. the property name was port)
looking directly at the MBean object.
But now it has been changed to go through the JMX api
(so it needs to use the JMX attribute name Port).
Alternatively, we could do as Scott says and try both in ServiceControllerContext
| public Object get(String name) throws Throwable
| {
| try
| {
| return getMBeanServer().getAttribute(objectName, name);
| }
| catch (AttributeNotFoundException orignal)
| {
| try
| {
| name = switchToUpperOrLowerCase(name);
| return getMBeanServer().getAttribute(objectName, name);
| }
| catch (AttributeNotFoundException e)
| {
| throw original;
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005232#4005232
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005232
19 years, 2 months