当前位置: 首页>>代码示例>>Java>>正文


Java Arquillian类代码示例

本文整理汇总了Java中org.jboss.arquillian.testng.Arquillian的典型用法代码示例。如果您正苦于以下问题:Java Arquillian类的具体用法?Java Arquillian怎么用?Java Arquillian使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Arquillian类属于org.jboss.arquillian.testng包,在下文中一共展示了Arquillian类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: putCustomListsTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 2)
@OperateOnDeployment("ear")
@RunAsClient
public void putCustomListsTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/lists/2"), HttpMethod.PUT);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    requestSettings.setRequestBody(
            "[{\"dns_client\":\"10.10.10.10/32\"," +
                    "\"lists\":{\"seznam.cz\":\"W\"," +
                    "\"google.com\":\"B\"," +
                    "\"example.com\":\"L\"}" +
                    "}," +
                    "{\"dns_client\":\"fe80::3ea9:f4ff:fe81:c450/64\"," +
                    "\"lists\":{\"seznam.cz\":\"L\"," +
                    "\"google.com\":\"W\"," +
                    "\"example.com\":\"W\"}" +
                    "}]");
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("putCustomListsTest Response:" + responseBody);
    String expected = "6 CUSTOM LISTS ELEMENTS PROCESSED, 6 PRESENT";
    assertTrue(responseBody.contains(expected), "Expected: " + expected + ", but got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:27,代码来源:ApiIntegrationTest.java

示例2: getIoCTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 6)
@OperateOnDeployment("ear")
@RunAsClient
public void getIoCTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/blacklist/record/seznam.cz"), HttpMethod.GET);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("getIoCTest Response:" + responseBody);
    String expected = "\"black_listed_domain_or_i_p\":\"aed14ad7ed6c543f818a4cfe89cb8f20\""; // md5 of seznam.cz
    assertTrue(responseBody.contains(expected), "IoC response should have contained " + expected + ", but got:" + responseBody);
    expected = "\"sources\":{\"feed2\":{\"a\":\"blacklist\",\"b\":\"myDocumentId\"}}";
    assertTrue(responseBody.contains(expected), "IoC should have contained " + expected + ", but got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:18,代码来源:ApiIntegrationTest.java

示例3: cleanElasticTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
/**
 * Not test exactly, just cleaning old data in elastic
 *
 * @param context
 * @throws Exception
 */

@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 8)
@OperateOnDeployment("ear")
@RunAsClient
public void cleanElasticTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(
            new URL("http://" + System.getenv("SINKIT_ELASTIC_HOST") + ":" + System.getenv("SINKIT_ELASTIC_PORT") +
                    "/" + ArchiveServiceEJB.ELASTIC_IOC_INDEX + "/"), HttpMethod.DELETE);
    Page page;
    try {
        page = webClient.getPage(requestSettings);
        assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    } catch (FailingHttpStatusCodeException ex) {
        //NO-OP index does not exist yet, but it's ok
    }
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:24,代码来源:ApiIntegrationTest.java

示例4: iocInElasticTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 10)
public void iocInElasticTest() throws Exception {

    String feed = "integrationTest";
    String type = "phishing";
    String fqdn = "phishing.ru";
    String iocId = "d056ec334e3c046f0d7fdde6f3d02c8b";  // id hash from values above

    IoCRecord ioc = archiveService.getIoCRecordById(iocId);
    assertNotNull(ioc, "Excpecting IoC, but got null with fqdn: " + fqdn + ", type: " + type + ", feed: " + feed);
    assertEquals(ioc.getFeed().getName(), feed, "Expected feed.name: " + feed + ", but got: " + ioc.getFeed().getName());
    assertEquals(ioc.getSource().getId().getType(), IoCSourceIdType.FQDN, "Expected source.id.type: " + IoCSourceIdType.FQDN + ", but got: " + ioc.getSource().getId().getType());
    assertEquals(ioc.getSource().getId().getValue(), fqdn, "Expected source.id.value: " + fqdn + ", but got: " + ioc.getSource().getId().getValue());
    assertEquals(ioc.getClassification().getType(), type, "Expected classification.type: " + type + ", but got: " + ioc.getClassification().getType());
    assertNotNull(ioc.getSeen().getFirst(), "Expected seen.first but got null");
    assertNotNull(ioc.getSeen().getLast(), "Expected seen.last but got null");
    Calendar c = Calendar.getInstance();
    c.add(Calendar.HOUR, -coreService.getIocActiveHours());
    assertTrue(ioc.getSeen().getLast().after(c.getTime()), "Expected seen.last is not older than " + coreService.getIocActiveHours() + " hours, but got " + ioc.getSeen().getLast());
    assertTrue(ioc.isActive(), "Expected ioc to be active, but got active: false");
    assertNotNull(ioc.getTime().getObservation(), "Expecting time.observation, but got null");
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:23,代码来源:ApiIntegrationTest.java

示例5: iocInCacheTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 11)
@OperateOnDeployment("ear")
@RunAsClient
public void iocInCacheTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/blacklist/record/phishing.ru"), HttpMethod.GET);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("iocInCacheTest Response:" + responseBody);
    String expected = "\"black_listed_domain_or_i_p\":\"926dab5157943daed27851a34f30b701\"";  // md5 of phishing.ru
    assertTrue(responseBody.contains(expected), "IoC response should have contained " + expected + ", but got:" + responseBody);
    expected = "\"sources\":{\"integrationTest\":{\"a\":\"phishing\",\"b\":\"";
    assertTrue(responseBody.contains(expected), "IoC should have contained " + expected + ", but got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:18,代码来源:ApiIntegrationTest.java

示例6: putAndGetTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
/**
 * put white list entry
 * get white list entry
 * assert its correct data
 */
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 300)
public void putAndGetTest() throws Exception {
    LOGGER.log(Level.INFO, "putAndGetTest");
    Calendar before = Calendar.getInstance();
    before.add(Calendar.SECOND, VALID_HOURS * 3600 - 1);
    assertTrue(coreService.processWhitelistIoCRecord(IoCFactory.getIoCForWhitelist("1.2.3.4", null, "whitelist", false)));
    assertTrue(coreService.processWhitelistIoCRecord(IoCFactory.getIoCForWhitelist(null, "whalebone.io", "whalebone", false)));
    Calendar after = Calendar.getInstance();
    after.add(Calendar.SECOND, VALID_HOURS * 3600 + 1);
    WhitelistedRecord whiteIP = whitelistService.get("1.2.3.4");
    WhitelistedRecord whiteFQDN = whitelistService.get("whalebone.io");
    assertNotNull(whiteIP);
    assertNotNull(whiteFQDN);
    assertEquals(whiteIP.getRawId(), "1.2.3.4");
    assertEquals(whiteFQDN.getRawId(), "whalebone.io");
    assertEquals(whiteIP.getSourceName(), "whitelist");
    assertEquals(whiteFQDN.getSourceName(), "whalebone");
    assertNotNull(whiteIP.getExpiresAt());
    assertNotNull(whiteFQDN.getExpiresAt());
    assertTrue(before.before(whiteIP.getExpiresAt()));
    assertTrue(before.before(whiteFQDN.getExpiresAt()));
    assertTrue(after.after(whiteIP.getExpiresAt()));
    assertTrue(after.after(whiteFQDN.getExpiresAt()));
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:30,代码来源:WhitelistCacheServiceTest.java

示例7: expirationTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
/**
 * put whitelist entry and wait until it expires and disappears from whitelist cache
 */
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 305)
public void expirationTest() throws Exception {
    LOGGER.log(Level.INFO, "expirationTest");
    coreService.setWhitelistValidSeconds(1);
    assertTrue(coreService.processWhitelistIoCRecord(IoCFactory.getIoCForWhitelist(null, "willExpire", "nothing", false)));
    assertNotNull(whitelistService.get("willExpire"));
    int counter = 0;
    WhitelistedRecord white = whitelistService.get("willExpire");
    while (white != null && counter < 10) {
        Thread.sleep(100);
        white = whitelistService.get("willExpire");
        counter++;
    }
    assertNull(white);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:19,代码来源:WhitelistCacheServiceTest.java

示例8: deduplicationTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 12)
public void deduplicationTest() throws Exception {
    Calendar c = Calendar.getInstance();
    c.set(Calendar.MILLISECOND, 0);
    Date lastObservation = c.getTime();
    c.add(Calendar.MINUTE, -10);
    Date firstObservation = c.getTime();
    assertNotEquals(firstObservation, lastObservation, "Expected last and first observation times to be different, but are the same: " + firstObservation);

    IoCRecord ioc = IoCFactory.getIoCRecordAsRecieved("deduplication", "phishing", "phishing.ru", IoCSourceIdType.FQDN, firstObservation, null);
    ioc = coreService.processIoCRecord(ioc);
    assertNotNull(ioc.getDocumentId(), "Expecting documentId generated by elastic, but got null");
    assertTrue(ioc.isActive(), "Expected ioc to be active, but got inactive");
    IoCRecord iocDupl = IoCFactory.getIoCRecordAsRecieved("deduplication", "phishing", "phishing.ru", IoCSourceIdType.FQDN, lastObservation, null);
    iocDupl = coreService.processIoCRecord(iocDupl);
    assertEquals(iocDupl.getDocumentId(), ioc.getDocumentId(), "Expected documentId: " + ioc.getDocumentId() + ", but got: " + iocDupl.getDocumentId());
    assertTrue(iocDupl.isActive(), "Expected iocDupl to be active, but got inactive");
    IoCRecord iocIndexed = archiveService.getIoCRecordById(iocDupl.getDocumentId());
    assertNotNull(iocIndexed, "Expecting ioc to be found in elastic, but got null");
    assertEquals(iocIndexed.getDocumentId(), ioc.getDocumentId(), "Expexted found document id: " + ioc.getDocumentId() + ", but got: " + iocIndexed.getDocumentId());
    assertEquals(iocIndexed.getSeen().getLast(), lastObservation, "Expected seen.last: " + lastObservation + ", but got: " + iocIndexed.getSeen().getLast());
    assertEquals(iocIndexed.getTime().getObservation(), firstObservation, "Expected time.observation: " + firstObservation + ", but got " + iocIndexed.getTime().getObservation());
    assertEquals(iocIndexed.getSeen().getFirst(), firstObservation, "Expected seen.first: " + firstObservation + ", but got: " + iocIndexed.getSeen().getFirst());
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:25,代码来源:CoreTest.java

示例9: goodTimeTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 15)
public void goodTimeTest() throws Exception {
    Calendar c = Calendar.getInstance();
    c.set(Calendar.MILLISECOND, 0);
    Date timeObservation = c.getTime();
    c.add(Calendar.HOUR, -coreService.getIocActiveHours());
    c.add(Calendar.SECOND, 1);
    Date timeSource = c.getTime();

    Calendar c1 = Calendar.getInstance();
    c1.add(Calendar.MILLISECOND, -1);
    Date receivedByCore = c1.getTime();

    IoCRecord source = IoCFactory.getIoCRecordAsRecieved("sourceTime", "phishing", "phishing.ru", IoCSourceIdType.FQDN, timeObservation, timeSource);
    source = coreService.processIoCRecord(source);
    assertEquals(source.getSeen().getFirst(), timeSource, "Expected seen.first: " + timeSource + ", but got: " + source.getSeen().getFirst());
    assertEquals(source.getSeen().getLast(), timeSource, "Expected seen.last: " + timeSource + ", but got: " + source.getSeen().getLast());
    assertTrue(receivedByCore.before(source.getTime().getReceivedByCore()), "Expected time.receivedByCore to be after " + receivedByCore + ", but was: " + source.getTime().getReceivedByCore());

    IoCRecord observation = IoCFactory.getIoCRecordAsRecieved("observationTime", "phishing", "phishing.ru", IoCSourceIdType.FQDN, timeObservation, null);
    observation = coreService.processIoCRecord(observation);
    assertEquals(observation.getSeen().getFirst(), timeObservation, "Expected seen.first: " + timeObservation + ", but got: " + observation.getSeen().getFirst());
    assertEquals(observation.getSeen().getLast(), timeObservation, "Expected seen.last: " + timeObservation + ", but got: " + observation.getSeen().getLast());
    assertTrue(receivedByCore.before(observation.getTime().getReceivedByCore()), "Expected time.receivedByCore to be after " + receivedByCore + ", but was: " + observation.getTime().getReceivedByCore());
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:26,代码来源:CoreTest.java

示例10: cleanElasticTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
/**
 * Not test exactly, just cleaning old data in elastic DNS event logs
 *
 * @param context
 * @throws Exception
 */
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 17)
@OperateOnDeployment("ear")
@RunAsClient
public void cleanElasticTest(@ArquillianResource URL context) throws Exception {

    String index = IoCFactory.getLogIndex();

    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(
            new URL("http://" + System.getenv("SINKIT_ELASTIC_HOST") + ":" + System.getenv("SINKIT_ELASTIC_PORT") +
                    "/" + index + "/"), HttpMethod.DELETE);
    Page page;
    try {
        page = webClient.getPage(requestSettings);
        assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    } catch (FailingHttpStatusCodeException ex) {
        //NO-OP index does not exist yet, but it's ok
    }
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:26,代码来源:CoreTest.java

示例11: getStatsTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 4)
@OperateOnDeployment("ear")
@RunAsClient
public void getStatsTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/stats"), HttpMethod.GET);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("getStatsTest Response:" + responseBody);
    String expected = "{\"rule\":4,\"ioc\":1}";
    assertTrue(responseBody.contains(expected), "Expected: " + expected + ". got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:16,代码来源:ApiIntegrationTest.java

示例12: getIoCsTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 5)
@OperateOnDeployment("ear")
@RunAsClient
public void getIoCsTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/blacklist/records"), HttpMethod.GET);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("getIoCsTest Response:" + responseBody);
    String expected = "[\"aed14ad7ed6c543f818a4cfe89cb8f20\"]"; // md5 of seznam.cz
    assertTrue(responseBody.contains(expected), "Expected " + expected + ", but got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:16,代码来源:ApiIntegrationTest.java

示例13: getSinkHoleTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 7)
@OperateOnDeployment("ear")
@RunAsClient
public void getSinkHoleTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/blacklist/dns/10.11.12.22/seznam.cz/seznam.cz"), HttpMethod.GET);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("getSinkHoleTest Response:" + responseBody);
    String expected = "{\"sinkhole\":\"" + System.getenv("SINKIT_SINKHOLE_IP") + "\"}";
    assertTrue(responseBody.contains(expected), "Should have contained " + expected + ", but got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:16,代码来源:ApiIntegrationTest.java

示例14: clearGSBCacheTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 200)
@OperateOnDeployment("ear")
@RunAsClient
public void clearGSBCacheTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/gsb"), HttpMethod.DELETE);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("clear gsb cache Response: " + responseBody);
    String expected = "true";
    assertTrue(responseBody.contains(expected), "Should have contained " + expected + ", but got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:16,代码来源:GSBTest.java

示例15: putHashPrefixTest

import org.jboss.arquillian.testng.Arquillian; //导入依赖的package包/类
@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 201)
@OperateOnDeployment("ear")
@RunAsClient
public void putHashPrefixTest(@ArquillianResource URL context) throws Exception {
    WebClient webClient = new WebClient();
    WebRequest requestSettings = new WebRequest(new URL(context + "rest/gsb/aabbccdd"), HttpMethod.PUT);
    requestSettings.setAdditionalHeader("Content-Type", "application/json");
    requestSettings.setAdditionalHeader("X-sinkit-token", TOKEN);
    Page page = webClient.getPage(requestSettings);
    assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
    String responseBody = page.getWebResponse().getContentAsString();
    LOGGER.info("hashPrefixTest Response:" + responseBody);
    String expected = "true";
    assertTrue(responseBody.contains(expected), "Should have contained " + expected + ", but got: " + responseBody);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:16,代码来源:GSBTest.java


注:本文中的org.jboss.arquillian.testng.Arquillian类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。