Search in sources :

Example 46 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project Payara by payara.

the class NucleusStartStopTest method setUp.

@BeforeSuite
public void setUp(ITestContext context) throws IOException {
    // Copy testing libraries into Nucleus distribution
    Collection<File> testLibs = new ArrayList<File>();
    context.setAttribute(TEST_LIBS_KEY, testLibs);
    String basedir = System.getProperty("basedir");
    assertNotNull(basedir);
    File addondir = new File(basedir, "target/addon");
    for (Map.Entry<String, String> entry : COPY_LIB.entrySet()) {
        copyLibraries(new File(addondir, entry.getKey()), new File(NucleusTestUtils.getNucleusRoot(), entry.getValue()), testLibs);
    }
    // Start
    assertTrue(nadmin("start-domain"));
}
Also used : ArrayList(java.util.ArrayList) File(java.io.File) HashMap(java.util.HashMap) Map(java.util.Map) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 47 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project rhsm-qe by RedHatQE.

the class SubscriptionManagerCLITestScript method deleteSomeSecondarySubscriptionsBeforeSuite.

@Deprecated
@BeforeSuite(groups = { "setup" }, dependsOnMethods = { "setupBeforeSuite" }, description = "delete selected secondary/duplicate subscriptions to reduce the number of available pools against a standalone candlepin server")
public void deleteSomeSecondarySubscriptionsBeforeSuite() throws JSONException, Exception {
    if (SubscriptionManagerTasks.isVersion(servertasks.statusVersion, ">=", "2.2.0-1")) {
        // effectively a permanent and suggested WORKAROUND prompted by Bug 1503578 - Runtime Error You can't operate on a closed ResultSet!!!
        // forward to newer task
        deleteSomeSecondarySubscriptionPoolsBeforeSuite();
        return;
    }
    Set<String> secondarySkusSkipped = new HashSet<String>();
    Set<String> secondarySkusToDelete = new HashSet<String>(Arrays.asList(new String[] { // [jsefler@jseflerT5400 ~]$ curl --stderr /dev/null --insecure --user admin:admin --request GET https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/owners/admin/subscriptions?include=product.id | python -m simplejson/tool | grep \"id\" | sort | awk '{print $2}' | xargs -i[] echo \"[]\",
    "2cores-2ram-multiattr", "2cores-2ram-multiattr", "awesomeos-all-just-86_64-cont", "awesomeos-all-just-86_64-cont", "awesomeos-all-no-86_64-cont", "awesomeos-all-no-86_64-cont", "awesomeos-all-x86-cont", "awesomeos-all-x86-cont", "awesomeos-docker", "awesomeos-docker", "awesomeos-everything", "awesomeos-everything", "awesomeos-guestlimit-4-stackable", "awesomeos-guestlimit-4-stackable", "awesomeos-i386", "awesomeos-i386", "awesomeos-i686", "awesomeos-i686", "awesomeos-ia64", "awesomeos-ia64", // "awesomeos-instancebased",	// future?
    "awesomeos-modifier", "awesomeos-modifier", "awesomeos-onesocketib", "awesomeos-onesocketib", "awesomeos-ostree", "awesomeos-ostree", "awesomeos-per-arch-cont", "awesomeos-per-arch-cont", "awesomeos-ppc64", "awesomeos-ppc64", "awesomeos-s390", "awesomeos-s390", "awesomeos-s390x", "awesomeos-s390x", "awesomeos-server", "awesomeos-server", "awesomeos-server-2-socket-std", "awesomeos-server-2-socket-std", // "awesomeos-server-basic",
    "awesomeos-server-basic-dc", "awesomeos-server-basic-dc", // "awesomeos-server-basic-me",	// future?
    "awesomeos-super-hypervisor", "awesomeos-super-hypervisor", "awesomeos-virt-4", "awesomeos-virt-4", "awesomeos-virt-datacenter", "awesomeos-virt-datacenter", "awesomeos-virt-unlimited", "awesomeos-virt-unlimited", "awesomeos-virt-unlmtd-phys", "awesomeos-virt-unlmtd-phys", "awesomeos-workstation-basic", "awesomeos-workstation-basic", "awesomeos-x86", "awesomeos-x86", "awesomeos-x86_64", "awesomeos-x86_64", "cores-26", "cores-26", "cores4-multiattr", "cores4-multiattr", "cores-8-stackable", "cores-8-stackable", "management-100", "management-100", // "MKT-multiplier-client-50",	// future?
    "non-stacked-6core8ram-multiattr", "non-stacked-6core8ram-multiattr", "non-stacked-8core4ram-multiattr", "non-stacked-8core4ram-multiattr", "non-stacked-multiattr", "non-stacked-multiattr", "ram-2gb-stackable", "ram-2gb-stackable", "ram2-multiattr", "ram2-multiattr", "ram-4gb-stackable", "ram-4gb-stackable", "ram-8gb", "ram-8gb", "ram-cores-8gb-4cores", "ram-cores-8gb-4cores", "sfs", "sfs", "sock2-multiattr", "sock2-multiattr", "sock-core-ram-multiattr", "sock-core-ram-multiattr", "stackable-with-awesomeos-x86_64", "stackable-with-awesomeos-x86_64", "virt-awesomeos-i386", "virt-awesomeos-i386", "" }));
    if (sm_clientOrg == null)
        return;
    if (!CandlepinType.standalone.equals(sm_serverType))
        return;
    // process all of the subscriptions belonging to ownerKey
    // /subscriptions?include=id&include=product.id
    JSONArray jsonSubscriptions = new JSONArray(CandlepinTasks.getResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, "/owners/" + sm_clientOrg + "/subscriptions"));
    List<String> secondarySubscriptionIdsDeleted = new ArrayList<String>();
    for (int i = 0; i < jsonSubscriptions.length(); i++) {
        JSONObject jsonSubscription = (JSONObject) jsonSubscriptions.get(i);
        JSONObject jsonProduct = (JSONObject) jsonSubscription.get("product");
        String productId = jsonProduct.getString("id");
        // skip all skus not on the list of secondarySkusToDelete
        if (!secondarySkusToDelete.contains(productId))
            continue;
        // skip the first secondarySkusToDelete encountered (this will be the one kept)
        if (!secondarySkusSkipped.contains(productId)) {
            secondarySkusSkipped.add(productId);
            continue;
        }
        // delete the subscription
        String subscriptionId = jsonSubscription.getString("id");
        CandlepinTasks.deleteResourceUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, "/subscriptions/" + subscriptionId);
        secondarySubscriptionIdsDeleted.add(subscriptionId);
    }
    // refresh the pools (only when some secondary subscriptions have been deleted)
    if (!secondarySubscriptionIdsDeleted.isEmpty()) {
        JSONObject jobDetail = CandlepinTasks.refreshPoolsUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, sm_clientOrg);
        jobDetail = CandlepinTasks.waitForJobDetailStateUsingRESTfulAPI(sm_serverAdminUsername, sm_serverAdminPassword, sm_serverUrl, jobDetail, "FINISHED", 5 * 1000, 1);
    }
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 48 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project selenium_java by sergueik.

the class AppTest method beforeSuiteMethod.

@BeforeSuite
public void beforeSuiteMethod() {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus_4_API_22");
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Browser");
    try {
        driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
    driver.manage().deleteAllCookies();
    wait = new WebDriverWait(driver, flexibleWait);
    wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
    actions = new Actions(driver);
    try {
        Dimension dimensions = driver.manage().window().getSize();
        // unknown error: operation is unsupported on Android
        // keep code for emulation tests
        screenWidth = dimensions.getWidth();
        screenHeight = dimensions.getHeight();
    } catch (WebDriverException e) {
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Actions(org.openqa.selenium.interactions.Actions) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) URL(java.net.URL) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 49 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project selenium_java by sergueik.

the class RunScriptTest method beforeSuiteMethod.

@BeforeSuite
public void beforeSuiteMethod() throws Exception {
    ((StdErrLog) Log.getRootLogger()).setLevel(StdErrLog.LEVEL_OFF);
    webServer = new Server(new QueuedThreadPool(5));
    ServerConnector connector = new ServerConnector(webServer, new HttpConnectionFactory());
    connector.setPort(8080);
    webServer.addConnector(connector);
    ResourceHandler resource_handler = new ResourceHandler();
    resource_handler.setDirectoriesListed(true);
    resource_handler.setWelcomeFiles(new String[] { "index.html" });
    resource_handler.setResourceBase("src/test/webapp");
    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
    webServer.setHandler(handlers);
    webServer.start();
    driver = new FirefoxDriver();
    driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
    wait = new WebDriverWait(driver, flexibleWait);
    wait.pollingEvery(pollingInterval, TimeUnit.MILLISECONDS);
    hashesFinderScript = getScriptContent("hashesFinder.js");
    resultFinderScript = getScriptContent("resultFinder.js");
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) HandlerList(org.eclipse.jetty.server.handler.HandlerList) StdErrLog(org.eclipse.jetty.util.log.StdErrLog) Server(org.eclipse.jetty.server.Server) HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) ResourceHandler(org.eclipse.jetty.server.handler.ResourceHandler) DefaultHandler(org.eclipse.jetty.server.handler.DefaultHandler) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 50 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project ballerina by ballerina-lang.

the class ServiceTest method createDir.

// TODO : Added as a temporary solution to create .ballerina directory
@BeforeSuite
public void createDir() throws IOException {
    // TODO : Done as a workaround to create the .ballerina directory
    Path filePath = Paths.get(sourceRoot + "/.ballerina");
    Files.deleteIfExists(filePath);
    Files.createDirectory(filePath);
}
Also used : Path(java.nio.file.Path) BeforeSuite(org.testng.annotations.BeforeSuite)

Aggregations

BeforeSuite (org.testng.annotations.BeforeSuite)66 HashMap (java.util.HashMap)13 PrismInternalTestUtil (com.evolveum.midpoint.prism.PrismInternalTestUtil)12 File (java.io.File)11 FileInputStream (java.io.FileInputStream)6 Properties (java.util.Properties)6 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)6 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)5 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)5 ZNRecordSerializer (org.apache.helix.manager.zk.ZNRecordSerializer)4 ZkClient (org.apache.helix.manager.zk.ZkClient)4 ChromeOptions (org.openqa.selenium.chrome.ChromeOptions)4 Actions (org.openqa.selenium.interactions.Actions)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Random (java.util.Random)3 SubscriptionManagerTasks (rhsm.cli.tasks.SubscriptionManagerTasks)3 SSHCommandResult (com.redhat.qe.tools.SSHCommandResult)2 CloudbreakClient (com.sequenceiq.cloudbreak.client.CloudbreakClient)2 InputStream (java.io.InputStream)2