Hi,

@kasun @rajith @denuwanthi @isuruwan Thanks you for your prompt reply.I
have tried the way which isuruwan mentiond above.It is working fine now.

On Wed, Oct 7, 2015 at 11:52 AM, Isuruwan Herath <isuru...@wso2.com> wrote:

> Also if you're using ResourceAdminServiceClient, this [1] is an example
> how resource exists is checked in G-Reg tests.
>
> [1]
> https://github.com/wso2/product-greg/blob/master/modules/integration/tests-integration/tests-metadata/tests-metadata-content/src/test/java/org/wso2/carbon/registry/metadata/test/util/TestUtils.java#L171
>
> On Wed, Oct 7, 2015 at 11:49 AM, Denuwanthi De Silva <denuwan...@wso2.com>
> wrote:
>
>> Hi Rajeenthini,
>>
>> You need to pass an 'AutomationContext' object to 'getWSRegistry' method.
>> Can you verify the method 'getUesContext' returns a proper
>> AutomationContext?
>>
>> Ex of defining an automation context fro greg product
>> AutomationContext context = new AutomationContext("GREG",
>> TestUserMode.SUPER_TENANT_ADMIN);
>>
>>
>> Thanks,
>>
>> On Tue, Oct 6, 2015 at 5:28 PM, Rajeenthini Satkunam <
>> rajeenth...@wso2.com> wrote:
>>
>>> Hi rajith,
>>>
>>> I have tried the way you mentioned.When I use like this
>>>
>>> RegistryProviderUtil provider = new RegistryProviderUtil();
>>> WSRegistryServiceClient registry = provider.getWSRegistry(getUesContext());
>>> assertFalse(registry.resourceExists(resourcePath),"Registry resource could 
>>> not be deleted due to some errors");
>>>
>>> It says like cannot resolve the method getWSRegistry(getUesContext())
>>>
>>> But I have tried this way too
>>>
>>> WSRegistryServiceClient registry = 
>>> provider.getWSRegistry(getCurrentUsername(),getCurrentPassword(), 
>>> UESIntegrationTestConstants.UES_PRODUCT_NAME);
>>>
>>> But when I run the test cases it is giving me a null pointer exception at 
>>> the point when I created registry instance.Could you please advice me on 
>>> how can I resolve this issue?
>>>
>>>
>>>
>>>
>>> On Tue, Oct 6, 2015 at 4:35 PM, Rajith Roshan <raji...@wso2.com> wrote:
>>>
>>>> Hi Rajeenthini,
>>>>
>>>> You can get the instance of registry as below and check if the resource
>>>> exists.
>>>>
>>>> RegistryProviderUtil provider = new RegistryProviderUtil();
>>>> WSRegistryServiceClient registry = 
>>>> provider.getWSRegistry(automationContext);
>>>>
>>>> if(registry.resourceExists(path))
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Rajith
>>>>
>>>>
>>>> On Tue, Oct 6, 2015 at 3:43 PM, Kasun Bandara <kas...@wso2.com> wrote:
>>>>
>>>>> Hi Rajeenthini,
>>>>>
>>>>> You can invoke the *boolean resourceExists(String resorcePath)*
>>>>> method through the Registry class comes with registry core. Returns true 
>>>>> if
>>>>> the resource exists in the specified path & returns false if it's not
>>>>> reside in the path.
>>>>>
>>>>> Thanks and Regards.
>>>>>
>>>>>
>>>>> On Tue, Oct 6, 2015 at 3:42 PM, Kasun Bandara <kas...@wso2.com> wrote:
>>>>>
>>>>>> Hi Rajeenthini,
>>>>>>
>>>>>> You can invoke the *boolean resourceExists(String resorcePath)*
>>>>>> method through the Registry class comes with registry core. Returns true 
>>>>>> if
>>>>>> the resource exists in the specified path & returns false if it's not
>>>>>> reside in the path.
>>>>>>
>>>>>> Thanks and Regards.
>>>>>>
>>>>>>
>>>>>> On Tue, Oct 6, 2015 at 12:35 PM, Rajeenthini Satkunam <
>>>>>> rajeenth...@wso2.com> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I am writing UI test cases for UES/Dashboard Server(DS).I have tried
>>>>>>> to write a test class for adding and deleting dashboard for the 
>>>>>>> Dashboard
>>>>>>> Server.Here I need to check the resource is existing or not at the
>>>>>>> registry.You can have a look for the class[1] I have wrote for adding 
>>>>>>> and
>>>>>>> deleting dashboard.
>>>>>>> [1] -
>>>>>>> https://github.com/rajeenthini/product-ues/commit/e642d50edf08cc21d2b0a2b21463e4b3aadc587a
>>>>>>>
>>>>>>> BTW I have modified my code in some ways .Those are I have included
>>>>>>> below
>>>>>>> - Deleted deleteResource method from here
>>>>>>> resourceAdminServiceClient.deleteResource(resourcePath);
>>>>>>>
>>>>>>> @AfterClass(alwaysRun = true)
>>>>>>> public void tearDown() throws MalformedURLException, 
>>>>>>> XPathExpressionException, RemoteException, 
>>>>>>> ResourceAdminServiceExceptionException {
>>>>>>>     try{
>>>>>>>         UESUIIntegrationTest.logout(getDriver(), getBaseUrl(), 
>>>>>>> getCurrentUsername());
>>>>>>>     }finally {
>>>>>>>         getDriver().quit();
>>>>>>>     }
>>>>>>> }
>>>>>>>
>>>>>>> - Added some code segment to the method deleteDashboard
>>>>>>>
>>>>>>> @Test(groups = "wso2.ues.dashboard", description = "Deleting added 
>>>>>>> dashboard", dependsOnMethods = "testAddDashboardNew")
>>>>>>> public void testDeleteDashboardNew() throws MalformedURLException, 
>>>>>>> XPathExpressionException, RemoteException, 
>>>>>>> ResourceAdminServiceExceptionException {
>>>>>>>     webElement = getDriver().findElement(By.id(dashboardTitle));
>>>>>>>     webElement.findElement(By.cssSelector("i.fw-delete")).click();
>>>>>>>     getDriver().findElement(By.cssSelector("span.ladda-label")).click();
>>>>>>>     assertFalse(getDriver().isElementPresent(By.id(dashboardTitle)), 
>>>>>>> "Error occurred while deleting dashboard" + dashboardTitle);
>>>>>>>     ResourceData[] resourceData = 
>>>>>>> resourceAdminServiceClient.getResourceData(resourcePath);
>>>>>>>     assertTrue(resourceData.length == 0,"Registry resource could not be 
>>>>>>> deleted due to some errors");
>>>>>>> }
>>>>>>>
>>>>>>> Now it's giving me exception when there is no such registry resource
>>>>>>> after dashboard was deleted by UI testcase.
>>>>>>>
>>>>>>> org.apache.axis2.AxisFault: Resource does not exist at path 
>>>>>>> /_system/config/ues/dashboards/sampledashboard1
>>>>>>>
>>>>>>> So can anyone give some suggestions on $subject? Thanks in advance.
>>>>>>> --
>>>>>>>
>>>>>>> *Thank You.*
>>>>>>>
>>>>>>> *Rajeenthini Satkunam*
>>>>>>>
>>>>>>> *Associate Software Engineer | WSO2*
>>>>>>>
>>>>>>>
>>>>>>> *E:rajeenth...@wso2.com <rajeenth...@wso2.com>*
>>>>>>>
>>>>>>> *M :+94770832823 <%2B94770832823>   *
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Dev mailing list
>>>>>>> Dev@wso2.org
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Kasun Bandara
>>>>>> *Software Engineer*
>>>>>> Mobile : +94 (0) 718 338 360
>>>>>> <%2B94%20%280%29%20773%20451194>
>>>>>> kas...@wso2.com <thili...@wso2.com>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Kasun Bandara
>>>>> *Software Engineer*
>>>>> Mobile : +94 (0) 718 338 360
>>>>> <%2B94%20%280%29%20773%20451194>
>>>>> kas...@wso2.com <thili...@wso2.com>
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Rajith Roshan
>>>> Software Engineer, WSO2 Inc.
>>>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> *Thank You.*
>>>
>>> *Rajeenthini Satkunam*
>>>
>>> *Associate Software Engineer | WSO2*
>>>
>>>
>>> *E:rajeenth...@wso2.com <rajeenth...@wso2.com>*
>>>
>>> *M :+94770832823 <%2B94770832823>   *
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Denuwanthi De Silva
>> Software Engineer;
>> WSO2 Inc.; http://wso2.com,
>> Email: denuwan...@wso2.com
>> Blog: https://denuwanthi.wordpress.com/
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Isuruwan Herath
> Technical Lead
>
> Contact: +94 776 273 296
>



-- 

*Thank You.*

*Rajeenthini Satkunam*

*Associate Software Engineer | WSO2*


*E:rajeenth...@wso2.com <rajeenth...@wso2.com>*

*M :+94770832823   *
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to