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


Java Arquillian.ARQUILLIAN_DATA_PROVIDER属性代码示例

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


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

示例1: putCustomListsTest

@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,代码行数:26,代码来源:ApiIntegrationTest.java

示例2: getIoCTest

@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,代码行数:17,代码来源:ApiIntegrationTest.java

示例3: goodTimeTest

@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,代码行数:25,代码来源:CoreTest.java

示例4: cleanElasticTest

/**
 * 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,代码行数:23,代码来源:ApiIntegrationTest.java

示例5: iocInElasticTest

@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,代码行数:22,代码来源:ApiIntegrationTest.java

示例6: putAndGetTest

/**
 * 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,代码行数:29,代码来源:WhitelistCacheServiceTest.java

示例7: cleanElasticTest

/**
 * 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,代码行数:25,代码来源:CoreTest.java

示例8: expirationTest

/**
 * 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,代码行数:18,代码来源:WhitelistCacheServiceTest.java

示例9: tooOldSourceTimeTest

@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 13, expectedExceptions = TooOldIoCException.class)
public void tooOldSourceTimeTest() throws Exception {
    Calendar c = Calendar.getInstance();
    c.set(Calendar.MILLISECOND, 0);
    Date timeObservation = c.getTime();
    c.add(Calendar.HOUR, -coreService.getIocActiveHours());
    Date timeSource = c.getTime();

    IoCRecord ioc = IoCFactory.getIoCRecordAsRecieved("tooOldIoc", "phishing", "phishing.ru", IoCSourceIdType.FQDN, timeObservation, timeSource);
    coreService.processIoCRecord(ioc);
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:11,代码来源:CoreTest.java

示例10: getStatsTest

@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,代码行数:15,代码来源:ApiIntegrationTest.java

示例11: getIoCsTest

@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,代码行数:15,代码来源:ApiIntegrationTest.java

示例12: dnsEventLogTestPrepare

@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 18)
public void dnsEventLogTestPrepare() throws Exception {
    String iocId1 = "d056ec334e3c046f0d7fdde6f3d02c8b";
    String iocId2 = "1c9b683e445fcb631cd86b06c882dd07";

    IoCRecord ioc1 = archiveService.getIoCRecordById(iocId1);
    IoCRecord ioc2 = archiveService.getIoCRecordById(iocId2);

    // note: feed name and types will be ignored since iocIds already exists
    // { feed: [type1 : iocId1, type2:iocId2, ...]}
    Map<String, Set<ImmutablePair<String, String>>> ids = new HashMap<>();
    Set<ImmutablePair<String, String>> typeIoCIds = new HashSet<>();
    typeIoCIds.add(new ImmutablePair<>("type1", iocId1));
    typeIoCIds.add(new ImmutablePair<>("type2", iocId2));
    ids.put("feed1", typeIoCIds);

    dnsApi.logDNSEvent(EventLogAction.BLOCK,
            "10.1.1.1",
            "10.1.1.2",
            "requestFqdn",
            "requestType",
            "seznam.cz",
            "10.1.1.3",
            ids,
            archiveService,
            LOGGER);
    // The async task follows Fire and Forget. TODO: dnsEventLogTestAssert must wait
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:28,代码来源:CoreTest.java

示例13: dropTheWholeCacheTest

@Test(enabled = false, dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER, priority = 306)
public void dropTheWholeCacheTest() throws Exception {
    LOGGER.log(Level.INFO, "dropTheWholeCacheTest");
    WhitelistedRecord whiteIP = whitelistService.get("1.2.3.4");
    assertNotNull(whiteIP);
    WhitelistedRecord whiteFQDNio = whitelistService.get("whalebone.io");
    assertNotNull(whiteFQDNio);
    WhitelistedRecord whiteFQDNcz = whitelistService.get("subdomain.whalebone.cz");
    assertNotNull(whiteFQDNcz);
    assertTrue(whitelistService.dropTheWholeCache());
    whiteIP = whitelistService.get("1.2.3.4");
    whiteFQDNio = whitelistService.get("whalebone.io");
    whiteFQDNcz = whitelistService.get("subdomain.whalebone.cz");
    int counter = 0;
    while ((whiteIP != null  || whiteFQDNio != null || whiteFQDNcz != null) && counter < 10 ) {
        Thread.sleep(100);
        whiteIP = whitelistService.get("1.2.3.4");
        whiteFQDNio = whitelistService.get("whalebone.io");
        whiteFQDNcz = whitelistService.get("subdomain.whalebone.cz");
        counter++;
    }
    assertNull(whiteIP);
    assertNull(whiteFQDNio);
    assertNull(whiteFQDNcz);
    counter = 0;
    while (!whitelistService.isWhitelistEmpty() && counter < 10) {
        counter++;
    }
    assertTrue(whitelistService.isWhitelistEmpty());
}
 
开发者ID:whalebone,项目名称:sinkit-core,代码行数:30,代码来源:WhitelistCacheServiceTest.java

示例14: clearGSBCacheTest

@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,代码行数:15,代码来源:GSBTest.java

示例15: putHashPrefixTest

@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,代码行数:15,代码来源:GSBTest.java


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