Search in sources :

Example 26 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project cloudbreak by hortonworks.

the class CloudbreakTestSuiteInitializer method initCloudbreakSuite.

@BeforeSuite(dependsOnMethods = "initContext")
@Parameters({ "cloudbreakServer", "cloudProvider", "credentialName", "instanceGroups", "hostGroups", "blueprintName", "stackName", "networkName", "securityGroupName" })
public void initCloudbreakSuite(@Optional("") String cloudbreakServer, @Optional("") String cloudProvider, @Optional("") String credentialName, @Optional("") String instanceGroups, @Optional("") String hostGroups, @Optional("") String blueprintName, @Optional("") String stackName, @Optional("") String networkName, @Optional("") String securityGroupName) {
    cloudbreakServer = StringUtils.hasLength(cloudbreakServer) ? cloudbreakServer : defaultCloudbreakServer;
    String cbServerRoot = cloudbreakServer + cbRootContextPath;
    itContext.putContextParam(CloudbreakITContextConstants.SKIP_REMAINING_SUITETEST_AFTER_ONE_FAILED, skipRemainingSuiteTestsAfterOneFailed);
    itContext.putContextParam(CloudbreakITContextConstants.CLOUDBREAK_SERVER, cloudbreakServer);
    itContext.putContextParam(CloudbreakITContextConstants.CLOUDBREAK_SERVER_ROOT, cbServerRoot);
    itContext.putContextParam(CloudbreakITContextConstants.CLOUDPROVIDER, cloudProvider);
    String identity = itContext.getContextParam(IntegrationTestContext.IDENTITY_URL);
    String user = itContext.getContextParam(IntegrationTestContext.AUTH_USER);
    String password = itContext.getContextParam(IntegrationTestContext.AUTH_PASSWORD);
    CloudbreakClient cloudbreakClient = new CloudbreakClientBuilder(cbServerRoot, identity, "cloudbreak_shell").withCertificateValidation(false).withIgnorePreValidation(true).withDebug(true).withCredential(user, password).build();
    itContext.putContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, cloudbreakClient);
    if (cleanUpBeforeStart) {
        cleanUpService.deleteTestStacksAndResources(cloudbreakClient);
    }
    putBlueprintToContextIfExist(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).blueprintEndpoint(), blueprintName);
    putNetworkToContext(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).networkEndpoint(), cloudProvider, networkName);
    putSecurityGroupToContext(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).securityGroupEndpoint(), cloudProvider, securityGroupName);
    putCredentialToContext(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).credentialEndpoint(), cloudProvider, credentialName);
    putStackToContextIfExist(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).stackV1Endpoint(), stackName);
    if (StringUtils.hasLength(instanceGroups)) {
        List<String[]> instanceGroupStrings = templateAdditionHelper.parseCommaSeparatedRows(instanceGroups);
        itContext.putContextParam(CloudbreakITContextConstants.TEMPLATE_ID, createInstanceGroups(itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).templateEndpoint(), instanceGroupStrings));
    }
    if (StringUtils.hasLength(hostGroups)) {
        List<String[]> hostGroupStrings = templateAdditionHelper.parseCommaSeparatedRows(hostGroups);
        itContext.putContextParam(CloudbreakITContextConstants.HOSTGROUP_ID, createHostGroups(hostGroupStrings));
    }
}
Also used : CloudbreakClient(com.sequenceiq.cloudbreak.client.CloudbreakClient) CloudbreakClientBuilder(com.sequenceiq.cloudbreak.client.CloudbreakClient.CloudbreakClientBuilder) Parameters(org.testng.annotations.Parameters) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 27 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project killbill by killbill.

the class GuicyKillbillTestSuite method globalBeforeSuite.

@BeforeSuite(alwaysRun = true)
public void globalBeforeSuite() {
    extraPropertiesForTestSuite.put("org.killbill.security.shiroResourcePath", "classpath:org/killbill/billing/util/shiro.ini");
    if (Boolean.valueOf(System.getProperty("killbill.test.redis", "false"))) {
        redisServer = new RedisServer(56379);
        redisServer.start();
        redissonClient = new RedissonCacheClientProvider("redis://127.0.0.1:56379", 1, null).get();
        theRealClock = new DistributedClockMock();
        ((DistributedClockMock) theRealClock).setRedissonClient(redissonClient);
        extraPropertiesForTestSuite.put("org.killbill.cache.config.redis", "true");
        extraPropertiesForTestSuite.put("org.killbill.cache.config.redis.url", "redis://127.0.0.1:56379");
    } else {
        theRealClock.resetDeltaFromReality();
    }
    // The clock needs to be setup early in @BeforeSuite, as it is needed when starting the server, but see below
    clock = theRealClock;
}
Also used : RedisServer(redis.embedded.RedisServer) RedissonCacheClientProvider(org.killbill.billing.util.glue.RedissonCacheClientProvider) DistributedClockMock(org.killbill.clock.DistributedClockMock) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 28 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project midpoint by Evolveum.

the class TestExpressionFunctions method setup.

@BeforeSuite
public void setup() throws SchemaException, SAXException, IOException {
    PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX);
    PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY);
    protector = KeyStoreBasedProtectorBuilder.create(getPrismContext()).keyStorePath("src/test/resources/keystore.jceks").keyStorePassword("changeit").initialize();
    clock = new Clock();
    basic = createBasicFunctions();
}
Also used : Clock(com.evolveum.midpoint.common.Clock) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 29 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project ats-framework by Axway.

the class BaseTestClass method beforeSuite.

@BeforeSuite
public void beforeSuite() {
    boolean hasServiceException = false;
    // quick sanity check if all servers are working properly
    log.info("Running SANITY check for Example servers...");
    // check agents
    log.info("ATS Agents sanity check START");
    try {
        String agent1AtsVersion = new SystemOperations(configuration.getAgent1Address()).getAtsVersion();
        log.info("Agent 1 is working and its version is: " + agent1AtsVersion);
        String agent2AtsVersion = new SystemOperations(configuration.getAgent1Address()).getAtsVersion();
        log.info("Agent 2 is working and its version is: " + agent2AtsVersion);
    } catch (Exception e) {
        hasServiceException = true;
        log.error(e);
    }
    log.info("ATS Agents sanity check END");
    log.info("HTTP Server sanity check START");
    // check HTTP server
    RestClient restClient = null;
    try {
        restClient = new RestClient("http://" + configuration.getServerIp() + ":" + configuration.getHttpServerPort());
        RestResponse rr = restClient.get();
        if (rr.getStatusCode() != 200) {
            throw new RuntimeException("HTTP Server server maybe in trouble or not started properly. Status of HTTP sanity check response is :\n\tStatus Message: " + rr.getStatusMessage() + "\n\tBody: " + rr.getBodyAsString());
        } else {
            log.info("HTTP server working");
        }
    } catch (Exception e) {
        hasServiceException = true;
        log.error(e);
    } finally {
        if (restClient != null) {
            restClient.disconnect();
            restClient = null;
        }
    }
    log.info("HTTP Server sanity check END");
    log.info("FTP/FTPS Server sanity check START");
    // check FTP/FTPS server (TODO)
    FtpClient ftpClient = null;
    try {
        ftpClient = new FtpClient();
        ftpClient.setCustomPort(configuration.getFtpServerPort());
        ftpClient.connect(configuration.getServerIp(), configuration.getUserName(), configuration.getUserPassword());
    } catch (Exception e) {
        hasServiceException = true;
        log.error(e);
    } finally {
        if (ftpClient != null) {
            ftpClient.disconnect();
            ftpClient = null;
        }
    }
    log.info("FTP/FTPS Server sanity check END");
    log.info("DONE running SANITY check for Examples servers");
    if (hasServiceException) {
        throw new RuntimeException("Not all servers started or working properly. Did you run 'Start servers' from the Desktop directory?");
    }
}
Also used : SystemOperations(com.axway.ats.action.system.SystemOperations) RestResponse(com.axway.ats.action.rest.RestResponse) RestClient(com.axway.ats.action.rest.RestClient) FtpClient(com.axway.ats.core.filetransfer.FtpClient) IOException(java.io.IOException) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 30 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project ats-framework by Axway.

the class HtmlEngineBaseTest method beforeSuiteHtmlEngineBaseTest.

@BeforeSuite
public void beforeSuiteHtmlEngineBaseTest() throws Exception {
    UiEngineConfigurator configurator = UiEngineConfigurator.getInstance();
    // set the base folder with the map files
    // configurator.setMapFilesBaseDir( "resources/com/axway/ats/uiengine/maps" );
    // overwrite some configuration properties for faster test execution
    configurator.setCommandDelay(-1);
    configurator.setElementStateChangeDelay(2000);
    configurator.setHighlightElements(false);
}
Also used : UiEngineConfigurator(com.axway.ats.uiengine.configuration.UiEngineConfigurator) BeforeSuite(org.testng.annotations.BeforeSuite)

Aggregations

BeforeSuite (org.testng.annotations.BeforeSuite)65 PrismInternalTestUtil (com.evolveum.midpoint.prism.PrismInternalTestUtil)12 HashMap (java.util.HashMap)12 File (java.io.File)11 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)6 FileInputStream (java.io.FileInputStream)5 Properties (java.util.Properties)5 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