package refactoring

merge-requests/1/head
Menaka Madushanka 9 years ago
parent 0ac1c73efe
commit e3f8956d29

@ -15,7 +15,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.wso2.carbon.iot.integration.web.ui.test; package org.wso2.carbon.iot.integration.web.ui.test.common;
public class Constants { public class Constants {
public static final String IOT_LOGIN_PATH = "/devicemgt/login"; public static final String IOT_LOGIN_PATH = "/devicemgt/login";

@ -0,0 +1,64 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.iot.integration.web.ui.test.common;
import org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException;
import org.wso2.carbon.automation.engine.context.AutomationContext;
import org.wso2.carbon.automation.engine.context.TestUserMode;
import org.wso2.carbon.automation.test.utils.common.HomePageGenerator;
import org.wso2.carbon.integration.common.admin.client.AuthenticatorClient;
import javax.xml.stream.XMLStreamException;
import javax.xml.xpath.XPathExpressionException;
import java.io.IOException;
import java.rmi.RemoteException;
public class IOTIntegrationUIBaseTestCase {
protected AutomationContext automationContext;
protected void init() throws IOException, XMLStreamException, XPathExpressionException {
automationContext = new AutomationContext("IOT", "iot001", TestUserMode.SUPER_TENANT_ADMIN);
}
protected String getBackendURL() throws XPathExpressionException {
return automationContext.getContextUrls().getBackEndUrl();
}
protected String getWebAppURL() throws XPathExpressionException {
return automationContext.getContextUrls().getWebAppURL();
}
protected String getSessionCookie(AutomationContext context)
throws RemoteException, XPathExpressionException, LoginAuthenticationExceptionException {
AuthenticatorClient authenticationAdminClient = new AuthenticatorClient(context.getContextUrls().getBackEndUrl());
return authenticationAdminClient.login(automationContext.getSuperTenant().
getTenantAdmin().getUserName(), automationContext.getSuperTenant().
getTenantAdmin().getPassword(),
automationContext.getDefaultInstance().getHosts().get("default"));
}
protected String getServiceURL() throws XPathExpressionException {
String serviceURL = automationContext.getContextUrls().getServiceUrl();
return automationContext.getContextUrls().getServiceUrl();
}
protected String getLoginURL() throws XPathExpressionException {
return HomePageGenerator.getProductHomeURL(automationContext);
}
}

@ -15,7 +15,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.wso2.carbon.iot.integration.web.ui.test; package org.wso2.carbon.iot.integration.web.ui.test.common;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.wso2.carbon.automation.engine.context.AutomationContext; import org.wso2.carbon.automation.engine.context.AutomationContext;

@ -23,9 +23,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage; import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage;
/** /**

@ -23,9 +23,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage; import org.wso2.iot.integration.ui.pages.groups.DeviceAddGroupPage;
import org.wso2.iot.integration.ui.pages.groups.DeviceGroupsPage; import org.wso2.iot.integration.ui.pages.groups.DeviceGroupsPage;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard; import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;

@ -25,14 +25,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.UIElementMapper; import org.wso2.iot.integration.ui.pages.UIElementMapper;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
import org.wso2.iot.integration.ui.pages.login.LoginPage;
import javax.xml.xpath.XPathExpressionException;
import java.io.IOException;
/** /**

@ -22,8 +22,8 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard; import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
import org.wso2.iot.integration.ui.pages.login.LoginPage; import org.wso2.iot.integration.ui.pages.login.LoginPage;

@ -23,9 +23,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage; import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard; import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceTypeViewPage; import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceTypeViewPage;

@ -23,9 +23,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.devices.DevicesPage; import org.wso2.iot.integration.ui.pages.devices.DevicesPage;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage; import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface; import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface;

@ -23,9 +23,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.devices.DevicesPage; import org.wso2.iot.integration.ui.pages.devices.DevicesPage;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage; import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage;
import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface; import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface;

@ -28,10 +28,10 @@ import org.wso2.carbon.automation.engine.exceptions.AutomationFrameworkException
import org.wso2.carbon.integration.common.admin.client.LogViewerClient; import org.wso2.carbon.integration.common.admin.client.LogViewerClient;
import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException; import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException;
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.logging.view.stub.LogViewerLogViewerException; import org.wso2.carbon.logging.view.stub.LogViewerLogViewerException;
import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent; import org.wso2.carbon.logging.view.stub.types.carbon.LogEvent;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamException;
import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathExpressionException;

@ -23,8 +23,8 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage; import org.wso2.iot.integration.ui.pages.devices.EnrollDevicePage;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard; import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;

@ -25,9 +25,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.UIElementMapper; import org.wso2.iot.integration.ui.pages.UIElementMapper;
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamException;

@ -22,9 +22,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.carbon.iot.integration.web.ui.test.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard; import org.wso2.iot.integration.ui.pages.home.IOTAdminDashboard;
import org.wso2.iot.integration.ui.pages.uesr.AddUserPage; import org.wso2.iot.integration.ui.pages.uesr.AddUserPage;
import org.wso2.iot.integration.ui.pages.uesr.UserListingPage; import org.wso2.iot.integration.ui.pages.uesr.UserListingPage;

@ -23,8 +23,8 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.UIElementMapper; import org.wso2.iot.integration.ui.pages.UIElementMapper;
import org.wso2.iot.integration.ui.pages.home.IOTHomePage; import org.wso2.iot.integration.ui.pages.home.IOTHomePage;
import org.wso2.iot.integration.ui.pages.login.LoginPage; import org.wso2.iot.integration.ui.pages.login.LoginPage;

@ -25,8 +25,8 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.iot.integration.web.ui.test.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants;
import org.wso2.iot.integration.ui.pages.IOTIntegrationUIBaseTestCase; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase;
import org.wso2.iot.integration.ui.pages.UIElementMapper; import org.wso2.iot.integration.ui.pages.UIElementMapper;
import org.wso2.iot.integration.ui.pages.uesr.NewUserRegisterPage; import org.wso2.iot.integration.ui.pages.uesr.NewUserRegisterPage;

Loading…
Cancel
Save