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


Java OperateOnDeployment类代码示例

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


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

示例1: startTestMethod

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
public void startTestMethod(@Observes(precedence = Integer.MAX_VALUE) Before event) {

        Method testMethod = event.getTestMethod();
        boolean runAsClient = event.getTestMethod().isAnnotationPresent(RunAsClient.class);
        String deploymentName = "_DEFAULT_";
        if (event.getTestMethod().isAnnotationPresent(OperateOnDeployment.class)) {
            deploymentName = event.getTestMethod().getAnnotation(OperateOnDeployment.class).value();
        }

        Reporter
            .createReport(new TestMethodReport(testMethod.getName()))
            .addKeyValueEntry(TEST_METHOD_OPERATES_ON_DEPLOYMENT, deploymentName)
            .addKeyValueEntry(TEST_METHOD_RUNS_AS_CLIENT, runAsClient)
            .inSection(new TestMethodSection(testMethod))
            .fire(sectionEvent);
    }
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:17,代码来源:ArquillianCoreReporterLifecycleManager.java

示例2: testSessionRemoveAttributes

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@RunAsClient
@Test
@OperateOnDeployment("session-operations")
public void testSessionRemoveAttributes(@ArquillianResource URL baseURL) throws IOException {
  URL url = url(baseURL, "TestServlet", "testSessionRemoveAttributes");
  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  List<String> cookies = connection.getHeaderFields().get("Set-Cookie");

  assertThat(connection, matchLines("Previous value of attribute: null", "New value of attribute: B"));
  url = url(baseURL, "RemoveAttributeServlet", "testSessionRemoveAttributes");
  System.out.println("COOKIES:" + cookies);
  connection = (HttpURLConnection) url.openConnection();
  setSessionCookie(connection, cookies);

  assertThat(connection, matchLines("Previous value of attribute: B", "New value of attribute: null"));
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:17,代码来源:ArqITSessionOperations.java

示例3: testSessionGetAttributes

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@RunAsClient
@Test
@OperateOnDeployment("session-operations")
public void testSessionGetAttributes(@ArquillianResource URL baseURL) throws IOException {
  URL url = url(baseURL, "TestServlet", "testSessionGetAttributes");
  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  List<String> cookies = connection.getHeaderFields().get("Set-Cookie");

  assertThat(connection, matchLines("Previous value of attribute: null", "New value of attribute: B"));
  url = url(baseURL, "GetAllAttributes", "testSessionGetAttributes");
  connection = (HttpURLConnection) url.openConnection();
  setSessionCookie(connection, cookies);

  assertThat(connection, matchLines("Attributes in session: [A]"));
  url = url(baseURL, "AddAttributeServlet", "testSessionGetAttributes");
  connection = (HttpURLConnection) url.openConnection();
  setSessionCookie(connection, cookies);
  assertThat(connection, matchLines("Previous value of attribute B: null", "New value of attribute B: D"));
  url = url(baseURL, "GetAllAttributes", "testSessionGetAttributes");
  connection = (HttpURLConnection) url.openConnection();
  setSessionCookie(connection, cookies);
  assertThat(connection, matchLines("Attributes in session: [A, B]"));
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:24,代码来源:ArqITSessionOperations.java

示例4: testDefaultSessionDoesNotExpireIn2Seconds

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@RunAsClient
@Test
@OperateOnDeployment("no-settings")
public void testDefaultSessionDoesNotExpireIn2Seconds(@ArquillianResource URL baseURL) throws IOException, InterruptedException {
  URL urlTest = url(baseURL, "TestServlet", "testDefaultSessionDoesNotExpireIn2Seconds");
  String originalCookie = callWebapp(urlTest);
  await(1000);
  HttpURLConnection connection = (HttpURLConnection) urlTest.openConnection();
  setSessionCookie(connection, originalCookie);
  connection.connect();
  List<String> cookies = connection.getHeaderFields().get("Set-Cookie");

  assertFirstLineEquals(connection, "Previous value of attribute: B");
  assertThat(cookies, hasItem(originalCookie));
  await(2100);
  connection = (HttpURLConnection) urlTest.openConnection();
  setSessionCookie(connection, originalCookie);
  connection.connect();
  cookies = connection.getHeaderFields().get("Set-Cookie");
  assertFirstLineEquals(connection, "Previous value of attribute: B");
  assertThat(cookies, hasItem(originalCookie));
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:23,代码来源:ArqITSessionExpire.java

示例5: testWhenSessionNeverExpires

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@RunAsClient
@Test
@OperateOnDeployment("never-expires")
public void testWhenSessionNeverExpires(@ArquillianResource URL baseURL) throws IOException, InterruptedException {
  URL urlTest = url(baseURL, "TestServlet", "testWhenSessionNeverExpires");
  String originalCookie = callWebapp(urlTest);
  await(1000);
  HttpURLConnection connection = (HttpURLConnection) urlTest.openConnection();
  setSessionCookie(connection, originalCookie);
  connection.connect();
  List<String> cookies = connection.getHeaderFields().get("Set-Cookie");

  assertFirstLineEquals(connection, "Previous value of attribute: B");
  assertThat(cookies, hasItem(originalCookie));
  await(2100);
  connection = (HttpURLConnection) urlTest.openConnection();
  setSessionCookie(connection, originalCookie);
  connection.connect();
  cookies = connection.getHeaderFields().get("Set-Cookie");
  assertFirstLineEquals(connection, "Previous value of attribute: B");
  assertThat(cookies, hasItem(originalCookie));
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:23,代码来源:ArqITSessionExpire.java

示例6: testSessionIdIsUuid

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@RunAsClient
@Test
@OperateOnDeployment("uuid")
public void testSessionIdIsUuid(@ArquillianResource URL baseURL) throws IOException {
  URL urlTest = url(baseURL, "TestServlet", "testSessionIdIsUuid");
  String originalCookie = callWebapp(urlTest);
  String justCookie = originalCookie.split(";", 2)[0];
  assertThat(justCookie, containsString("-"));
  assertThat(justCookie, startsWith("JSESSIONID="));
  try {
    UUID.fromString(justCookie.substring("JSESSIONID=".length()));
  } catch (Exception e) {
    fail("Invalid format of UUID " + justCookie);
  }
  HttpURLConnection connection = (HttpURLConnection)urlTest.openConnection();
  setSessionCookie(connection, originalCookie);
  assertFirstLineEquals(connection, "Previous value of attribute: B");
  List<String> cookies = connection.getHeaderFields().get("Set-Cookie");
  assertThat(cookies, hasItem(originalCookie));
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:21,代码来源:ArqITSessionUUIDCookies.java

示例7: testSessionNotPropagatedToOtherWebapp

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@RunAsClient
@Test
@OperateOnDeployment(FIRST_WEBAPP)
public void testSessionNotPropagatedToOtherWebapp(@ArquillianResource @OperateOnDeployment(FIRST_WEBAPP) URL firstURL,
    @ArquillianResource @OperateOnDeployment(SECOND_WEBAPP) URL secondURL) throws IOException {
  URL urlTestFirst = url(firstURL, "TestServlet", "testSessionNotPropagatedToOtherWebapp");
  URL urlTestSecond = url(secondURL, "SecondServlet", "testSessionNotPropagatedToOtherWebapp");
  String originalCookie = callWebapp(urlTestFirst);
  System.out.println("First app cookies: " + originalCookie);
  String secondCookie = callSecondWebApp(urlTestSecond, originalCookie);
  // Call again first webapp with cookie from first webapp, it works
  HttpURLConnection connection = (HttpURLConnection) urlTestFirst.openConnection();
  setSessionCookie(connection, originalCookie);
  connection.connect();

  assertFirstLineEquals(connection, "Previous value of attribute: B");

  // Call again first webapp with cookie from second webapp, it creates new
  // session
  connection = (HttpURLConnection) urlTestFirst.openConnection();
  setSessionCookie(connection, secondCookie);
  connection.connect();
  String newCookie = connection.getHeaderFields().get("Set-Cookie").get(0);
  Assert.assertFalse(originalCookie.equals(newCookie));
  assertFirstLineEquals(connection, "Previous value of attribute: null");
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:27,代码来源:ArqITSessionWithCookieTwoApps.java

示例8: testEJBClient

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@Test
@RunAsClient
@OperateOnDeployment("jaxws-samples-serviceref")
public void testEJBClient() throws Exception
{      
   InitialContext iniCtx = null;
   try
   {
      iniCtx = getServerInitialContext();
      EJBRemote ejbRemote = (EJBRemote)iniCtx.lookup("jaxws-samples-serviceref-ejbclient//EJBClient!" + EJBRemote.class.getName());

      String helloWorld = "Hello World!";
      Object retObj = ejbRemote.echo(helloWorld);
      assertEquals(helloWorld, retObj);
   }
   finally
   {
      if (iniCtx != null)
      {
         iniCtx.close();
      }
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:24,代码来源:ServiceRefTestCase.java

示例9: test

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@Test
@RunAsClient
@OperateOnDeployment(DEP)
public void test() throws Exception
{
   URL wsdlURL = new URL(baseURL + "/JBWS3792WSService?wsdl");
   QName qname = new QName("http://test.jbws3792/", "JBWS3792WSService");
   Service service = Service.create(wsdlURL, qname);

   Iterator<QName> it = service.getPorts();
   int cnt = 0;
   while (it.hasNext()) {
      cnt++;
      QName qn = (QName)it.next();
      assertTrue("qname: " + qn.toString(), "{http://test.jbws3792/}JBWS3792WSPort".equals(qn.toString()));
   }
   assertTrue("Expected cnt to be 1 but cnt is " + cnt, cnt == 1);
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:19,代码来源:JBWS3792WsImplTestCase.java

示例10: iocInCacheTest

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的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

示例11: cleanElasticTest

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的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

示例12: shouldFindTimerTicks

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@Test
@OperateOnDeployment("FunctionalIT-shouldFindTimerTicks")
public void shouldFindTimerTicks(@ArquillianResource @OperateOnDeployment("FunctionalIT-shouldFindTimerTicks")
                                     URL deployment)
        throws InterruptedException {

    LOG.info(deployment.toExternalForm());

    MILLISECONDS.sleep(1500);

    Collection<MyEntity> results =
            em.createQuery("select e from MyEntity e", MyEntity.class)
                    .getResultList();

    assertThat(results, hasSize(greaterThan(0)));
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:17,代码来源:FunctionalIT.java

示例13: cleanElasticTest

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的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

示例14: testWSDLAccess

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
@Test
@RunAsClient
@OperateOnDeployment(DEP)
public void testWSDLAccess() throws Exception
{
   URL wsdlURL = new URL(baseURL + "/jaxws-cxf-jaxbintros/EndpointService?wsdl");
   Element wsdl = DOMUtils.parse(wsdlURL.openStream());
   assertNotNull(wsdl);
   Iterator<Element> it = DOMUtils.getChildElements(wsdl, new QName("http://www.w3.org/2001/XMLSchema","attribute"), true);
   boolean attributeFound = false;
   while (it.hasNext())
   {
      Element el = it.next();
      if ("string".equals(el.getAttribute("name")))
      {
         attributeFound = true;
      }
   }
   assertTrue("<xs:attribute name=\"string\" ..> not found in wsdl", attributeFound);
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:21,代码来源:JAXBIntroTestCase.java

示例15: testNoClientCallback

import org.jboss.arquillian.container.test.api.OperateOnDeployment; //导入依赖的package包/类
/**
 * No CallbackHandler is provided in STSCLient.  Username and password provided instead.
 *
 * @throws Exception
 */
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoClientCallback() throws Exception {
   Bus bus = BusFactory.newInstance().createBus();
   try {
      BusFactory.setThreadDefaultBus(bus);

      final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
      final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
      Service service = Service.create(wsdlURL, serviceName);
      ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);

      final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
      final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
      URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
      WSTrustTestUtils.setupWsseAndSTSClientNoCallbackHandler(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);

      assertEquals("WS-Trust Hello World!", proxy.sayHello());
   } finally {
      bus.shutdown(true);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:30,代码来源:WSTrustTestCase.java


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