类org.testng.annotations.BeforeClass源码实例Demo

下面列出了怎么用org.testng.annotations.BeforeClass的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: micro-integrator   文件: SequenceStatisticsTest.java
@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
}
 
源代码2 项目: micro-integrator   文件: Sample61TestCase.java
@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();

}
 
@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;
    }

}
 
@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]");
    }
}
 
源代码5 项目: micro-integrator   文件: TaskTests.java
@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);
}
 
@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");
}
 
源代码7 项目: presto   文件: TestPrestoDriver.java
@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"));
}
 
@BeforeClass(alwaysRun = true)
public void init() throws Exception {

    // Initialize ESBMediatorTest
    super.init();
    registryManager = new MicroRegistryManager();
}
 
@BeforeClass
public void init()
{
    Session session = testSessionBuilder()
            .setSystemProperty("legacy_timestamp", "false")
            .setTimeZoneKey(getTimeZoneKey("Pacific/Apia"))
            .build();
    assertions = new QueryAssertions(session);
}
 
@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");
}
 
@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"));

}
 
@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");
}
 
@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) + "/";

}
 
@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();
}
 
源代码15 项目: presto   文件: TestServer.java
@BeforeClass
public void setup()
{
    server = TestingPrestoServer.builder()
            .setProperties(ImmutableMap.<String, String>builder()
                    .put("http-server.process-forwarded", "true")
                    .build())
            .build();
    client = new JettyHttpClient();
}
 
源代码16 项目: FHIR   文件: JDBCSearchNearTest.java
@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();

}
 
@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");
}
 
@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);
}
 
@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();
}
 
@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());
}
 
源代码21 项目: presto   文件: TestQueryStateInfoResource.java
@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;
        }
    }
}
 
源代码22 项目: submarine   文件: homeIT.java
@BeforeClass
public static void startUp(){
  LOG.info("[Testcase]: homeIT");
  driver =  WebDriverManager.getWebDriver();
}
 
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
}
 
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
}
 
源代码25 项目: presto   文件: TestTeradataFunctions.java
@BeforeClass
public void setUp()
{
    functionAssertions.installPlugin(new TeradataFunctionsPlugin());
}
 
源代码26 项目: constellation   文件: AttributeSetGetNGTest.java
@BeforeClass
public static void setUpClass() throws Exception {
}
 
@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.init();
    proxyServiceUrl = getProxyServiceURLHttp(proxyServiceName);
}
 
@BeforeClass(alwaysRun = true)
public void uploadSynapseConfig() throws Exception {
    super.init();
}
 
源代码29 项目: submarine   文件: workspaceIT.java
@BeforeClass
public static void startUp(){
  LOG.info("[Testcase]: workspaceIT");
  driver =  WebDriverManager.getWebDriver();
}
 
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
    super.init();
    symbol = FixedSizeSymbolGenerator.generateMessageMB(1);

}