>>>Somehow those 2 functions cover pretty much of the same functionality, isn't?
Actually ManagedBeanConfigurator#define was used for defining managed beans 
without lifecycle events etc. before specification containing Portable 
Integration chapter. After implementing portable integration, I replaced 
managed bean creation to BeansDeployer#defineManagedBean and 
ManagedBeanConfigurator#define was deperecated.  It is still used in some 
places that contains "TestContext" class. 

>>>Gurkan, do you think we can merge the functionalities somehow?
It is not necessary to merge them from code implementation becuase 
BeansDeployer#defineManagedBean already contains ManagedBeanConfigurator#define 
functionality. But we can update our code to replace old 
ManagedBeanConfigurator#define within several places.

>>>E.g. for the tests we could use BeansDeployer#deploy with a special
MetaDataDiscoveryService which only returns the one bean class under
test.

Currently tests do not work in the simulating container. Each test uses 
"TestContext" methods to do something . As you specified, we can implement 
simple "Lifecycle" implemetation using for the tests. It can be used fır future 
tests . 

Currently we have two implementation of "Lifecycle" that you can get help from 
their implementation.

EnterpriseLifecycle --> org.apache.webbeans.lifecycle.EnterpriseLifecycle uses 
WarMetaDataDiscoveryImpl
StandaloneLifecycle-->org.apache.webbeans.lifecycle.StandaloneLifecycle uses 
MetaDataDiscoveryStandard

We can implement whatever funtionality in "TestLifecycle" using 
"TestMetaDataDisceovery."

Thanks;

--Gurkan


________________________________
From: Mark Struberg <[email protected]>
To: [email protected]
Sent: Thu, October 29, 2009 12:29:43 AM
Subject: divergence between ManagedBeanConfigurator#define and 
BeansDeployer#defineManagedBean

Hi!

Somehow those 2 functions cover pretty much of the same functionality, isn't?

Gurkan, do you think we can merge the functionalities somehow?

E.g. for the tests we could use BeansDeployer#deploy with a special 
MetaDataDiscoveryService which only returns the one bean class under test.

something like: 

TestContext#defineSimpleWebBean(Class<T> clazz) {
  BeansDeployer bd = getBeansDeployer();
  MetaDataDiscoveryService mockMdd = new MockMetaDataDiscoveryService(clazz);
  bd.deploy(mockMdd);
}

similar stuff for XML, etc. got me?

This way we could test all the lifecycle events and stuff. For my gut feeling 
the test container code is way too far from the 'real' lifecycle code currently.

Should I try it, or do you see any problem which will be a show stopper?

LieGrue,
strub


      

Reply via email to