what if we write the test only using CarbonContext and
PrivilegedCarbonContext. ?

- getting CarbonContextDataHolder is not possible
- getting registry service is wrong within a unit test

"*carbonContextDataHolder.getConfigSystemRegistry();*" - we should be able
to do the same thing using the new apis.

I think it is somewhat similar to,
cc.getRegistry(<registryType>);
you have to populate CC before doing this, as the method call takes tenant
info from the CC. Just a thought, didnt go through the code or tested it.

--Pradeep





On Fri, Dec 14, 2012 at 1:08 AM, Dileepa Jayakody <[email protected]> wrote:

> In CC the registry is now retrieved using registryService from
> OSGIDataHolder like below;
>  eg:
>     if (tenantId != MultitenantConstants.INVALID_TENANT_ID) {
>                  registry = *
> dataHolder.getRegistryService().getConfigSystemRegistry(tenantId);*
>                  setRegistry(RegistryType.SYSTEM_CONFIGURATION, registry);
>                  return registry;
>        }
> In carbon.4.0.4 and before, it merely returned the registry from
> carbonContextDataHolder as below;
> *return carbonContextDataHolder.getConfigSystemRegistry();*
>
> So in the unitsTests when trying to acces registryService in current CC
> implementation, it fails as there is no OSGi registry service available
> during the unit test life-cycle.
> Any idea on how to fix the unitTests here?
>
> Thanks,
> Dileepa
>
>
> On Thu, Dec 13, 2012 at 7:43 PM, Dileepa Jayakody <[email protected]>wrote:
>
>>
>>
>> On Thu, Dec 13, 2012 at 7:28 PM, Pradeep Fernando <[email protected]>wrote:
>>
>>> Hi Dileepa,
>>>
>>> im still getting the error in my c5-scratch. shariqs
>>> configSystemRegistry null fix is present in the code.
>>>
>>> Yes, I get it in C5 scratch locally. working on it.
>>
>>>  T E S T S
>>> -------------------------------------------------------
>>> Running
>>> org.wso2.carbon.core.test.security.AuthenticatorsConfigurationTest
>>> log4j:WARN No appenders could be found for logger
>>> (org.apache.axiom.om.util.StAXUtils).
>>> log4j:WARN Please initialize the log4j system properly.
>>> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.209 sec
>>> Running org.wso2.carbon.core.test.persistence.PersistenceUtilsTest
>>> log4j:WARN No appenders could be found for logger
>>> (org.wso2.carbon.context.internal.CarbonContextDataHolder).
>>> log4j:WARN Please initialize the log4j system properly.
>>> Tests run: 4, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.423
>>> sec <<< FAILURE!
>>> Running org.wso2.carbon.core.test.persistence.PersistenceManagerTest
>>> log4j:WARN No appenders could be found for logger
>>> (org.wso2.carbon.context.internal.CarbonContextDataHolder).
>>> log4j:WARN Please initialize the log4j system properly.
>>> Tests run: 14, Failures: 0, Errors: 14, Skipped: 0, Time elapsed: 2.758
>>> sec <<< FAILURE!
>>> Running org.wso2.carbon.core.test.persistence.ParameterUtilTest
>>> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.12 sec
>>> Running org.wso2.carbon.core.test.config.CarbonAxisConfiguratorTest
>>> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 sec
>>>
>>> Results :
>>>
>>> Tests in error:
>>>
>>> testGetResourcePath1(org.wso2.carbon.core.test.persistence.PersistenceUtilsTest)
>>>
>>> testGetResourcePath3(org.wso2.carbon.core.test.persistence.PersistenceUtilsTest)
>>>
>>> testNewServiceGroupAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testSetServiceGroupProperty(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testNewServiceAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testServiceProperty(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testUpdateServiceGroupParameter(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testUpdateServiceParameter(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testNewModuleAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testNewModuleNullVersionAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testModuleParameterUpdate(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testDeleteService(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testRemoveServiceParam(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testDeleteServiceGroup(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testRemoveModule(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>> testengageModuleForService(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>
>>>
>>> Tests run: 23, Failures: 0, Errors: 16, Skipped: 0
>>>
>>>
>>> On Thu, Dec 13, 2012 at 6:54 PM, Dileepa Jayakody <[email protected]>wrote:
>>>
>>>> There was a problem in CC registry returning logic where it's always
>>>> returning null regardless of the tenantID.
>>>> Since that issue is now fixed, the tests should be passing.
>>>>
>>>> Thanks,
>>>> Dileepa
>>>>
>>>>
>>>> On Thu, Dec 13, 2012 at 6:22 PM, Dileepa Jayakody <[email protected]>wrote:
>>>>
>>>>>
>>>>>
>>>>> On Thu, Dec 13, 2012 at 6:15 PM, Muhammed Shariq <[email protected]>wrote:
>>>>>
>>>>>>  Hi Dileepa,
>>>>>>
>>>>>> This test is still failing in builder3
>>>>>> Looking into it.
>>>>>>
>>>>>> On Thu, Dec 13, 2012 at 12:09 PM, Dileepa Jayakody 
>>>>>> <[email protected]>wrote:
>>>>>>
>>>>>>> Yes Krishantha I committed the changes to carbon.core 4.0.5 in
>>>>>>> r151291.
>>>>>>> Could it be because bamboo source not updated to latest for the last
>>>>>>> build?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Dileepa
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Dec 13, 2012 at 11:39 AM, Krishantha Samaraweera <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi Dileepa,
>>>>>>>>
>>>>>>>> Last bamboo kernel build[1] also failed due to following failures.
>>>>>>>> Did you commit the fixes to branch?
>>>>>>>>
>>>>>>>> build 12-Dec-2012 21:00:49 Tests in error:
>>>>>>>>
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testNewServiceGroupAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testSetServiceGroupProperty(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testNewServiceAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testServiceProperty(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testUpdateServiceGroupParameter(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testUpdateServiceParameter(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testNewModuleAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testNewModuleNullVersionAddition(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testModuleParameterUpdate(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testDeleteService(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testRemoveServiceParam(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testDeleteServiceGroup(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testRemoveModule(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testengageModuleForService(org.wso2.carbon.core.test.persistence.PersistenceManagerTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testGetResourcePath1(org.wso2.carbon.core.test.persistence.PersistenceUtilsTest)
>>>>>>>> build  12-Dec-2012 21:00:49      
>>>>>>>> testGetResourcePath3(org.wso2.carbon.core.test.persistence.PersistenceUtilsTest)
>>>>>>>> build  12-Dec-2012 21:00:49    
>>>>>>>> build  12-Dec-2012 21:00:49    Tests run: 23, Failures: 0, Errors: 16, 
>>>>>>>> Skipped: 0
>>>>>>>> build  12-Dec-2012 21:00:49    
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Krishantha
>>>>>>>>
>>>>>>>> [1]
>>>>>>>> http://wso2.org/bamboo/download/WCB001-KER005-JOB1/build_logs/WCB001-KER005-JOB1-54.log
>>>>>>>>
>>>>>>>>  On Wed, Dec 12, 2012 at 1:40 PM, Dileepa Jayakody <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> fixed in 151291, by initializing super-tenant flow for
>>>>>>>>> PersistenceUtilsTest and PersistenceManagerTest.
>>>>>>>>>
>>>>>>>>> The reason the tests were failing was, tenantId is not initialized
>>>>>>>>> (-1) when Registry instance is created from 
>>>>>>>>> CarbonContext.getRegistry().
>>>>>>>>> Now the tenantId is set to superTenantID in the test's setup flow.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Dileepa
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Dec 11, 2012 at 10:27 AM, Dileepa Jayakody <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> I will look into this
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Dec 11, 2012 at 10:17 AM, Muhammed Shariq <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> We need to get this test passing ASAP .. can someone have a look
>>>>>>>>>>> please ?!
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Dec 10, 2012 at 11:19 AM, Dinusha Senanayaka <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Build ran with the r150786. Surefire reports are attached
>>>>>>>>>>>> herewith..
>>>>>>>>>>>>
>>>>>>>>>>>> Regards,
>>>>>>>>>>>> Dinusha.
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>> [email protected]
>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Shariq.
>>>>>>>>>>> Phone: +94 777 202 225
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Dileepa Jayakody,
>>>>>>>>>> Software Engineer, WSO2 Inc.
>>>>>>>>>> Lean . Enterprise . Middleware
>>>>>>>>>>
>>>>>>>>>> Mobile : +94777-857616
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Dileepa Jayakody,
>>>>>>>>> Software Engineer, WSO2 Inc.
>>>>>>>>> Lean . Enterprise . Middleware
>>>>>>>>>
>>>>>>>>> Mobile : +94777-857616
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Dev mailing list
>>>>>>>>> [email protected]
>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Dileepa Jayakody,
>>>>>>> Software Engineer, WSO2 Inc.
>>>>>>> Lean . Enterprise . Middleware
>>>>>>>
>>>>>>> Mobile : +94777-857616
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks,
>>>>>> Shariq.
>>>>>> Phone: +94 777 202 225
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dileepa Jayakody,
>>>>> Software Engineer, WSO2 Inc.
>>>>> Lean . Enterprise . Middleware
>>>>>
>>>>> Mobile : +94777-857616
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Dileepa Jayakody,
>>>> Software Engineer, WSO2 Inc.
>>>> Lean . Enterprise . Middleware
>>>>
>>>> Mobile : +94777-857616
>>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> *Pradeep Fernando*
>>> Member, Management Committee - Platform & Cloud Technologies
>>> Senior Software Engineer;WSO2 Inc.; http://wso2.com
>>>
>>> blog: http://pradeepfernando.blogspot.com
>>> m: +94776603662
>>>
>>
>>
>>
>> --
>> Dileepa Jayakody,
>> Software Engineer, WSO2 Inc.
>> Lean . Enterprise . Middleware
>>
>> Mobile : +94777-857616
>>
>>
>
>
> --
> Dileepa Jayakody,
> Software Engineer, WSO2 Inc.
> Lean . Enterprise . Middleware
>
> Mobile : +94777-857616
>
>


-- 
*Pradeep Fernando*
Member, Management Committee - Platform & Cloud Technologies
Senior Software Engineer;WSO2 Inc.; http://wso2.com

blog: http://pradeepfernando.blogspot.com
m: +94776603662
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to