[QA of JBoss Portal] - JBoss Unit integration with JBoss MC
by julien@jboss.com
I have been able to prototype an integration of the current JBoss Unit + JBoss MC which makes trivial the parametrization of complex test cases that required services, here is just a simple example:
| @Test
| @Bootstrap("/mytest/jboss-beans.xml");
| public class MyTest
| {
|
| private String dataSourceName;
| private DataSource dataSource;
|
| public String getDataSourceName()
| {
| return dataSourceName;
| }
|
| @Parameter
| public void setDataSourceName(String dataSourceName)
| {
| this.dataSourceName = dataSourceName;
| }
|
| @Inject(bean="DataSource")
| public void setDataSource(DataSource dataSource)
| {
| this.dataSource = dataSource;
| }
|
| @Test
| public void test()
| {
| // use data source here
| }
| }
|
so we annotate the test case to be a parameterized test case with the dataSourceName parameter and to refer to an MC bean deployment + the injection of one of those beans in the test case.
jboss-beans.xml looks like:
| <deployment>
|
| <bean name="DataSource" class="javax.sql.DataSource">
| <constructor>
| <factory name="some factory">
| <parameter><inject bean="TestCase" property="dataSourceName" state="Instantiated"/></parameter>
| </factory>
| </constructor>
| </bean>
|
| </deployment>
|
here we define some factory for a data source object we need and we configure it to use the "implicit" TestCase bean, making usage of one of its parameterized properties.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091518#4091518
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091518
18 years, 6 months
[Design of POJO Server] - Re: ManagedOperation aspects for the ProfileService.Manageme
by alesj
"alesj" wrote :
| Since WritethroughManagedPropertyImpl is exactly what we need on the server side, but we definitely don't want to push/serialize this to the client.
|
I'm thinking about something similar to this:
I would like to change the serialization marshaler for a particular invocation.
e.g. ManagementView.getComponentsForType(ComponentType type)
| public Set<ManagedComponent> getComponentsForType(ComponentType type)
| throws Exception
| {
| SerializationMarshaller old = SerializationUtil.getCurrentMarshaller();
| try
| {
| SerializationMarshaller wmpi = WMPIClientMarshaler.INSTANCE;
| SerializationUtil.setCurrentMarshaller(wmpi);
| return compByCompType.get(type);
| }
| finally
| {
| SerializationUtil.setCurrentMarshaller(old);
| }
| }
|
Where the WMPIClientMarshaler would marshall all WritethroughManagedPropertyImpl to ManagedPropertyImpl.
Or is this too hacky?
Or even impossible? :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091513#4091513
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091513
18 years, 6 months