org.testng.annotations.BeforeClass Java Examples

The following examples show how to use org.testng.annotations.BeforeClass. 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 File: Sample61TestCase.java    From micro-integrator with 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 #2
Source File: LogMediatorLevelsAndCategoryTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@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 #3
Source File: TaskTests.java    From micro-integrator with 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 #4
Source File: StreamingXpathExceptionTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@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 #5
Source File: PropertyPersistenceDeletingAndAddingTstCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@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 #6
Source File: SequenceStatisticsTest.java    From micro-integrator with 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 #7
Source File: TestServer.java    From presto with 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 #8
Source File: TestQueryStateInfoResource.java    From presto with 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 #9
Source File: JDBCSearchNearTest.java    From FHIR with 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 #10
Source File: CallOutMediatorWithMTOMTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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 #11
Source File: ValidateIntegrationDynamicSchemaChangeTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    // Initialize ESBMediatorTest
    super.init();
    registryManager = new MicroRegistryManager();
}
 
Example #12
Source File: DS1190JsonValueTypeMisMatchTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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 #13
Source File: MessageProcessorPersistenceTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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 #14
Source File: TestTimestampWithTimeZoneToTimeCast.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public void init()
{
    Session session = testSessionBuilder()
            .setSystemProperty("legacy_timestamp", "false")
            .setTimeZoneKey(getTimeZoneKey("Pacific/Apia"))
            .build();
    assertions = new QueryAssertions(session);
}
 
Example #15
Source File: FilterWithSecurityManagerTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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 #16
Source File: SecurityTransformationProxyForPolicy7BackEndTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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 #17
Source File: ESBJAVA4909MultipartRelatedTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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 #18
Source File: CallMediatorBlockingWSDLEndpointTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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 #19
Source File: ESBJAVA1897HttpHeadMethodTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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
Source File: DeactivatedCappMPBehaviourOnRestartTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@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 #21
Source File: TestPrestoDriver.java    From presto with 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 #22
Source File: ProxyServiceEndPointThroughURLTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
}
 
Example #23
Source File: ESBJAVA4781EscapeAutoPrimitiveTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();

}
 
Example #24
Source File: PreferentialAttachmentPluginNGTest.java    From constellation with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
}
 
Example #25
Source File: SendIntegrationDynamicSequenceTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
}
 
Example #26
Source File: GlyphRectangleBufferNGTest.java    From constellation with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
}
 
Example #27
Source File: AdamicAdarIndexPluginNGTest.java    From constellation with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
}
 
Example #28
Source File: ESBJAVA4891ConsumeAndDiscardTest.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
    input = FileUtils.readFileToString(new File(
            getESBResourceLocation() + "/passthru/transport/inputESBJAVA4891.xml"), "ISO-8859-1");
}
 
Example #29
Source File: TransformPayloadWhenArgsExpressionTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
}
 
Example #30
Source File: TaskMediaTypeTestCase.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public void init() throws Exception {
    super.init();
    taskAdminClient = new TaskAdminClient(contextUrls.getBackEndUrl(), getSessionCookie());
    resourceAdmin = new ResourceAdminServiceClient(contextUrls.getBackEndUrl(), getSessionCookie());
}