Java Code Examples for org.testng.annotations.BeforeClass

The following examples show how to use org.testng.annotations.BeforeClass. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: micro-integrator   Source File: SequenceStatisticsTest.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
protected void initialize() throws Exception {
    //Starting the thrift port to listen to statistics events
    thriftServer = new ThriftServer("Wso2EventTestCase", 7612, true);
    thriftServer.start(7612);
    log.info("Thrift Server is Started on port 7612");

    //Changing synapse configuration to enable statistics and tracing
    ServerConfigurationManager serverConfigurationManager = new ServerConfigurationManager(
            new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    serverConfigurationManager.applyMIConfigurationWithRestart(new File(
            getESBResourceLocation() + File.separator + "StatisticTestResources" + File.separator
                    + "deployment.toml"));
    super.init();
    thriftServer.waitToReceiveEvents(20000); //waiting for esb to send artifact config data to the thriftserver
}
 
Example 2
Source Project: micro-integrator   Source File: Sample61TestCase.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();

    axis2Server1 = new SampleAxis2Server("test_axis2_server_9001.xml");
    axis2Server2 = new SampleAxis2Server("test_axis2_server_9002.xml");
    axis2Server3 = new SampleAxis2Server("test_axis2_server_9003.xml");

    axis2Server1.deployService(SampleAxis2Server.SIMPLE_STOCK_QUOTE_SERVICE);
    axis2Server2.deployService(SampleAxis2Server.SIMPLE_STOCK_QUOTE_SERVICE_2);
    axis2Server3.deployService(SampleAxis2Server.SIMPLE_STOCK_QUOTE_SERVICE_3);

    axis2Server1.start();
    axis2Server2.start();
    axis2Server3.start();

    listener1 = new TCPMonListener(9100, "localhost", 9001);
    listener2 = new TCPMonListener(9200, "localhost", 9002);
    listener3 = new TCPMonListener(9300, "localhost", 9003);

    listener1.start();
    listener2.start();
    listener3.start();

}
 
Example 3
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    serverManager = new ServerConfigurationManager(new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN));
    File sourceFile = new File(
            FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "ESB" + File.separator
                    + "streamingxpath" + File.separator + "synapse.properties");
    serverManager.applyConfiguration(sourceFile);
    super.init();
    String relativePath = "artifacts" + File.separator + "ESB" + File.separator + "streamingxpath" + File.separator
            + "StreamingException.xml";
    ESBTestCaseUtils util = new ESBTestCaseUtils();
    OMElement proxyConfig = util.loadResource(relativePath);

    try {
        addProxyService(proxyConfig);
    } catch (Exception ignore) {
        exceptionCaught = true;
    }

}
 
Example 4
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    if (!(osname.contains("windows"))) {

        super.init();
        serverConfigurationManager = new ServerConfigurationManager(context);
        serverConfigurationManager.copyToComponentLib(new File(
                getClass().getResource(JAR_LOCATION + File.separator + CLASS_JAR_FIVE_PROPERTIES).toURI()));
        OMElement class_five_properties = AXIOMUtil.stringToOM(FileUtils.readFileToString(
                new File(getESBResourceLocation() + File.separator + "mediatorconfig" + File.separator +
                        "class" + File.separator + "class_property_persistence_five_properties.xml")));
        Utils.deploySynapseConfiguration(class_five_properties, "class_property_persistence_five_properties",
                "proxy-services", true);

        super.init();
    } else {
        log.info("Skip the test execution in Windows. [Unable to delete dropins in Winodws]");
    }
}
 
Example 5
Source Project: micro-integrator   Source File: TaskTests.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
void initialize() throws Exception {

    context = new AutomationContext();
    serverManager = new MultipleServersManager();
    logManager = new LogReaderManager();
    HashMap<String, String> startupParameters = new HashMap<>();
    startupParameters.put("-DSynapseServerName", "pinnedServerCluster");
    startupParameters.put("-DnodeId", "node-1");
    node1 = getNode(30, startupParameters);
    startupParameters.clear();
    startupParameters.put("-DnodeId", "node-2");
    node2 = getNode(40, startupParameters);
    serverManager.startServersWithDepSync(true, node1, node2);
    reader1 = new CarbonLogReader(node1.getCarbonHome());
    reader2 = new CarbonLogReader(node2.getCarbonHome());
    logManager.start(reader1, reader2);
    deployArtifacts(serverManager.getDeploymentDirectory(), Utils.ArtifactType.TASK, TASK_1, TASK_2, TASK_COMPLETE,
                    TASK_PINNED);
}
 
Example 6
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    context = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);
    serverConfigurationManager = new ServerConfigurationManager(context);
    serverConfigurationManager.applyMIConfiguration(new File(getESBResourceLocation() + "/other/" + "log4j2.properties"));
    serverConfigurationManager.restartMicroIntegrator();
    init();
    carbonLogReader = new CarbonLogReader();
    carbonLogReader.start();
    //allow time for log reader to start
    Thread.sleep(1000);

    OMElement response = axis2Client
            .sendSimpleStockQuoteRequest(getProxyServiceURLHttp("LogMediatorLevelAndCategoryTestProxy"), null,
                    "WSO2");
    Assert.assertTrue(response.toString().contains("WSO2"), "Did not receive the expected response");
}
 
Example 7
Source Project: presto   Source File: TestPrestoDriver.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void setup()
        throws Exception
{
    Logging.initialize();
    server = TestingPrestoServer.create();
    server.installPlugin(new TpchPlugin());
    server.createCatalog(TEST_CATALOG, "tpch");
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole");
    waitForNodeRefresh(server);
    setupTestTables();
    executorService = newCachedThreadPool(daemonThreadsNamed("test-%s"));
}
 
Example 8
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    // Initialize ESBMediatorTest
    super.init();
    registryManager = new MicroRegistryManager();
}
 
Example 9
@BeforeClass
public void init()
{
    Session session = testSessionBuilder()
            .setSystemProperty("legacy_timestamp", "false")
            .setTimeZoneKey(getTimeZoneKey("Pacific/Apia"))
            .build();
    assertions = new QueryAssertions(session);
}
 
Example 10
@BeforeClass
public void setup() throws Exception {
    setSecurityManager = System.getSecurityManager() != null;
    Object toDeserialized = Long.MAX_VALUE;
    bytes = SerialFilterTest.writeObjects(toDeserialized);
    filter = ObjectInputFilter.Config.createFilter("java.lang.Long");
}
 
Example 11
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();

    ResourceAdminServiceClient resourceAdmin = new ResourceAdminServiceClient(contextUrls.getBackEndUrl(),
            sessionCookie);
    resourceAdmin.addCollection("/_system/config/", "securityTransform", "collection", "policy files");
    resourceAdmin.addResource("/_system/config/securityTransform/scenario7-policy.xml", "application/xml", "dss",
            new DataHandler(new URL("file:///" + policyPath + "scenario7-policy.xml")));

    updateESBConfiguration(SecureEndpointSetter.setEndpoint(
            "/artifacts/ESB/proxyconfig/proxy/secureProxy/security_transformation_proxy_for_policy7_backend.xml"));

}
 
Example 12
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    loadESBConfigurationFromClasspath(
            File.separator + "artifacts" + File.separator + "ESB" + File.separator + "mediatorconfig"
                    + File.separator + "call" + File.separator + "CallMediatorBlockingWSDLEndpointTest.xml");
}
 
Example 13
@BeforeClass(alwaysRun = true)
public void serviceDeployment() throws Exception {
    super.init();
    List<File> sqlFileLis = new ArrayList<File>();
    sqlFileLis.add(selectSqlFile("CreateTableJsonTest.sql"));
    deployService(serviceName, createArtifact(
            getResourceLocation() + File.separator + "samples" + File.separator + "dbs" + File.separator + "rdbms"
                    + File.separator + serviceName + ".dbs", sqlFileLis));
    serviceEndPoint = getServiceUrlHttp(serviceName) + "/";

}
 
Example 14
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    context = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);
    axis2Server = new SampleAxis2Server("test_axis2_server_9001.xml");
    axis2Server.deployService(SampleAxis2Server.SIMPLE_STOCK_QUOTE_SERVICE);
    axis2Server.start();
}
 
Example 15
Source Project: presto   Source File: TestServer.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void setup()
{
    server = TestingPrestoServer.builder()
            .setProperties(ImmutableMap.<String, String>builder()
                    .put("http-server.process-forwarded", "true")
                    .build())
            .build();
    client = new JettyHttpClient();
}
 
Example 16
Source Project: FHIR   Source File: JDBCSearchNearTest.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void startup() throws Exception {
    LogManager.getLogManager().readConfiguration(
            new FileInputStream("../fhir-persistence/src/test/resources/logging.unitTest.properties"));

    FHIRConfiguration.setConfigHome("../fhir-persistence/target/test-classes");
    FHIRRequestContext.get().setTenantId("default");

    testProps = TestUtil.readTestProperties("test.jdbc.properties");

    DerbyInitializer derbyInit;
    String dbDriverName = this.testProps.getProperty("dbDriverName");
    if (dbDriverName != null && dbDriverName.contains("derby")) {
        derbyInit = new DerbyInitializer(this.testProps);
        derbyInit.bootstrapDb();
    }

    savedResource = TestUtil.readExampleResource("json/spec/location-example.json");

    persistence   = new FHIRPersistenceJDBCImpl(this.testProps);

    SingleResourceResult<Location> result =
            persistence.create(FHIRPersistenceContextFactory.createPersistenceContext(null), savedResource);
    assertTrue(result.isSuccess());
    assertNotNull(result.getResource());
    savedResource = result.getResource();

}
 
Example 17
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    axis2Server = new SampleAxis2Server("test_axis2_server_9001.xml");
    axis2Server.start();
    axis2Server.deployService(MTOM_SERVICE);
    esbUtils.isProxyServiceExist(contextUrls.getBackEndUrl(), sessionCookie, "CallOutMediatorWithMTOMProxy");
}
 
Example 18
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    axis2Server = new SampleAxis2Server("test_axis2_server_9001.xml");
    axis2Server.start();
    axis2Server.deployService(MTOM_SERVICE);
}
 
Example 19
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    // start the axis2 server and deploy the Student Service

    //    	if (FrameworkFactory.getFrameworkProperties(ProductConstant.ESB_SERVER_NAME).getEnvironmentSettings().is_builderEnabled()) {
    axis2Server1 = new SampleAxis2Server("test_axis2_server_9009.xml");
    axis2Server1.start();
    axis2Server1.deployService(ESBTestConstant.SIMPLE_AXIS2_SERVICE);
    axis2Server1.deployService(ESBTestConstant.STUDENT_REST_SERVICE);
    //    	}
    super.init();
}
 
Example 20
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    super.init();
   /* serverConfigurationManager = new ServerConfigurationManager(contextUrls.getBackEndUrl(),
            TestUserMode.SUPER_TENANT_ADMIN);*/
    synapseConfigAdminClient = new SynapseConfigAdminClient(contextUrls.getBackEndUrl(), getSessionCookie());
}
 
Example 21
Source Project: presto   Source File: TestQueryStateInfoResource.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void setUp()
{
    server = TestingPrestoServer.create();
    server.installPlugin(new TpchPlugin());
    server.createCatalog("tpch", "tpch");
    client = new JettyHttpClient();

    Request request1 = preparePost()
            .setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/statement").build())
            .setBodyGenerator(createStaticBodyGenerator(LONG_LASTING_QUERY, UTF_8))
            .setHeader(PRESTO_USER, "user1")
            .build();
    queryResults = client.execute(request1, createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC));
    client.execute(prepareGet().setUri(queryResults.getNextUri()).build(), createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC));

    Request request2 = preparePost()
            .setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/statement").build())
            .setBodyGenerator(createStaticBodyGenerator(LONG_LASTING_QUERY, UTF_8))
            .setHeader(PRESTO_USER, "user2")
            .build();
    QueryResults queryResults2 = client.execute(request2, createJsonResponseHandler(jsonCodec(QueryResults.class)));
    client.execute(prepareGet().setUri(queryResults2.getNextUri()).build(), createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC));

    // queries are started in the background, so they may not all be immediately visible
    while (true) {
        List<BasicQueryInfo> queryInfos = client.execute(
                prepareGet()
                        .setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/query").build())
                        .setHeader(PRESTO_USER, "unknown")
                        .build(),
                createJsonResponseHandler(listJsonCodec(BasicQueryInfo.class)));
        if ((queryInfos.size() == 2) && queryInfos.stream().allMatch(info -> info.getState() == RUNNING)) {
            break;
        }
    }
}
 
Example 22
Source Project: submarine   Source File: homeIT.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void startUp(){
  LOG.info("[Testcase]: homeIT");
  driver =  WebDriverManager.getWebDriver();
}
 
Example 23
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
}
 
Example 24
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
}
 
Example 25
Source Project: presto   Source File: TestTeradataFunctions.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public void setUp()
{
    functionAssertions.installPlugin(new TeradataFunctionsPlugin());
}
 
Example 26
Source Project: constellation   Source File: AttributeSetGetNGTest.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
}
 
Example 27
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    proxyServiceUrl = getProxyServiceURLHttp(proxyServiceName);
}
 
Example 28
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
}
 
Example 29
Source Project: submarine   Source File: workspaceIT.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void startUp(){
  LOG.info("[Testcase]: workspaceIT");
  driver =  WebDriverManager.getWebDriver();
}
 
Example 30
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    symbol = FixedSizeSymbolGenerator.generateMessageMB(1);

}