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 <[email protected]> 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 <[email protected]> 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 <
>> [email protected]> 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:[email protected] <[email protected]>*
>>>
>>> *M :+94770832823 <%2B94770832823>   *
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Kasun Bandara
>> *Software Engineer*
>> Mobile : +94 (0) 718 338 360
>> <%2B94%20%280%29%20773%20451194>
>> [email protected] <[email protected]>
>>
>
>
>
> --
> Kasun Bandara
> *Software Engineer*
> Mobile : +94 (0) 718 338 360
> <%2B94%20%280%29%20773%20451194>
> [email protected] <[email protected]>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Rajith Roshan
Software Engineer, WSO2 Inc.
Mobile: +94-72-642-8350 <%2B94-71-554-8430>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to