Search in sources :

Example 56 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project oxAuth by GluuFederation.

the class ConfigurableTest method initTestSuite.

@BeforeSuite
public void initTestSuite(ITestContext context) throws FileNotFoundException, IOException {
    Reporter.log("Invoked init test suite method", true);
    String propertiesFile = context.getCurrentXmlTest().getParameter("propertiesFile");
    if (StringHelper.isEmpty(propertiesFile)) {
        propertiesFile = "target/test-classes/testng.properties";
    }
    // Load test parameters
    FileInputStream conf = new FileInputStream(propertiesFile);
    Properties prop;
    try {
        prop = new Properties();
        prop.load(conf);
    } finally {
        IOUtils.closeQuietly(conf);
    }
    Map<String, String> parameters = new HashMap<String, String>();
    for (Entry<Object, Object> entry : prop.entrySet()) {
        Object key = entry.getKey();
        Object value = entry.getValue();
        if (StringHelper.isEmptyString(key) || StringHelper.isEmptyString(value)) {
            continue;
        }
        parameters.put(key.toString(), value.toString());
    }
    // Override test parameters
    context.getSuite().getXmlSuite().setParameters(parameters);
}
Also used : HashMap(java.util.HashMap) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 57 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project open-ecard by ecsec.

the class AddonBundleDescriptionTest method setup.

@BeforeSuite
public void setup() throws IOException, WSMarshallerException, SAXException {
    // read the test xml
    InputStream descriptionStream = FileUtils.resolveResourceAsStream(AddonBundleDescriptionTest.class, TEST_DESCRIPTION);
    String s = FileUtils.toString(descriptionStream);
    // unmarshal it and check fields of POJO
    WSMarshaller marshaller = WSMarshallerFactory.createInstance();
    marshaller.removeAllTypeClasses();
    marshaller.addXmlTypeClass(AddonSpecification.class);
    Object o = marshaller.unmarshal(marshaller.str2doc(s));
    addonBundleDescription = (AddonSpecification) o;
}
Also used : InputStream(java.io.InputStream) WSMarshaller(org.openecard.ws.marshal.WSMarshaller) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 58 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project citrus-samples by christophd.

the class AbstractKubernetesIT method checkMinikubeEnvironment.

@BeforeSuite(alwaysRun = true)
public void checkMinikubeEnvironment() {
    try {
        Future<Boolean> future = Executors.newSingleThreadExecutor().submit(() -> {
            KubernetesClient kubernetesClient = new DefaultKubernetesClient();
            kubernetesClient.pods().list();
            return true;
        });
        future.get(5000, TimeUnit.MILLISECONDS);
        connected = true;
    } catch (Exception e) {
        log.warn("Skipping Kubernetes test execution as no proper Kubernetes environment is available on host system!", e);
    }
}
Also used : KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 59 with BeforeSuite

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

the class ExpressionHandlerImplTest method setup.

@BeforeSuite
public void setup() throws SchemaException, SAXException, IOException {
    PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX);
    PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY);
    // just something to fill into c:actor expression variable
    MidPointPrincipal principal = new MidPointPrincipal(new UserType(PrismTestUtil.getPrismContext()));
    SecurityContext securityContext = SecurityContextHolder.getContext();
    Authentication authentication = new UsernamePasswordAuthenticationToken(principal, null);
    securityContext.setAuthentication(authentication);
}
Also used : Authentication(org.springframework.security.core.Authentication) SecurityContext(org.springframework.security.core.context.SecurityContext) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) MidPointPrincipal(com.evolveum.midpoint.security.api.MidPointPrincipal) BeforeSuite(org.testng.annotations.BeforeSuite)

Example 60 with BeforeSuite

use of org.testng.annotations.BeforeSuite in project selenium-tests by Wikia.

the class UpvotingTests method setUp.

@BeforeSuite
private void setUp() {
    User user = User.USER_5;
    String siteId = Utils.extractSiteIdFromWikiName("qadiscussions", "de");
    existingPost = DiscussionsClient.using(user, driver).createPostWithUniqueData(siteId);
    DiscussionsClient.using(user, driver).createReplyToPost(siteId, existingPost);
}
Also used : User(com.wikia.webdriver.common.core.helpers.User) 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