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


Java RunAsClient类代码示例

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


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

示例1: verifyInjectedJTI

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
    description = "Verify that the injected jti claim is as expected")
public void verifyInjectedJTI() throws Exception {
    Reporter.log("Begin verifyInjectedJTI\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedJTI";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam(Claims.jti.name(), "a-123")
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:19,代码来源:JsonValueInjectionTest.java

示例2: testGet

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@Test
@RunAsClient
public void testGet() throws Exception {
	logger.info("Registering Client Level Filters");
	Client client = newClient();
	client.register(new OtherClientResponseFilter());
	WebTarget target = client.target(url + "myjaxrs/simple/");
	target.register(new OtherClientRequestFilter());

	WebTarget resourceTarget = target.path("/valuesget");
	resourceTarget = resourceTarget.queryParam("OrderID", "111").queryParam("UserName", "Luke");
	resourceTarget.register(new MyClientResponseFilter());
	resourceTarget.register(new MyClientRequestFilter());

	logger.info("Invoking REST Service: " + resourceTarget.getUri().toString());
	Invocation invocation = resourceTarget.request().buildGet();
	Response response = invocation.invoke();
	String respContent = "";

	if (response.hasEntity())
		respContent = response.readEntity(String.class);

	assertEquals("Response--> ", "111-Luke", respContent);
	assertEquals("Content Type after changing in ClientResponseFilter: ", TEXT_HTML,
			response.getHeaderString(CONTENT_TYPE_STRING));
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:27,代码来源:ComponentTestCase.java

示例3: verifyInjectedOptionalAuthTime2

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
    description = "Verify that the injected raw token claim is as expected")
public void verifyInjectedOptionalAuthTime2() throws Exception {
    Reporter.log("Begin verifyInjectedOptionalAuthTime\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedOptionalAuthTime";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:18,代码来源:ProviderInjectionTest.java

示例4: testStatelessRemoteNaming

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@Test
@RunAsClient
public void testStatelessRemoteNaming() throws Exception {
	logger.info("starting remoting ejb client test");

	try {
		createInitialContext();
		Machine machine = lookup(Machine.class, "machine");
		logger.info(machine + "");
		int result = machine.go(1);
		assertEquals(machine.getSpeed(), 1);
		logger.info(result + "");
		machine = lookup(Machine.class, "machine");
		logger.info(machine + "");
		assertEquals(machine.getSpeed(), 1);
	} finally {
		closeContext();
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:20,代码来源:RemotingNamingTestCase.java

示例5: testStatefulRemoteNaming

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@Test
@RunAsClient
public void testStatefulRemoteNaming() throws Exception {
	logger.info("starting remoting ejb client test");

	try {
		createInitialContext();
		StateMachine machine = lookup(StateMachine.class, "stateMachine");
		logger.info(machine + "");
		int result = machine.go(1);
		assertEquals(machine.getSpeed(), 1);
		logger.info(result + "");
		machine = lookup(StateMachine.class, "stateMachine");
		logger.info(machine + "");
		assertEquals(machine.getSpeed(), 0);
	} finally {
		closeContext();
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:20,代码来源:RemotingNamingTestCase.java

示例6: verifyInjectedRawToken2

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
    description = "Verify that the injected raw token claim is as expected from Token2")
public void verifyInjectedRawToken2() throws Exception {
    Reporter.log("Begin verifyInjectedRawToken2\n");
    String token2 = TokenUtils.generateTokenString("/Token2.json");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedRawToken";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam(Claims.raw_token.name(), token2)
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token2).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:20,代码来源:JsonValueInjectionTest.java

示例7: testRemoteXML

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@Test
@RunAsClient
public void testRemoteXML() throws Exception {
	logger.info("starting remoting ejb client test");

	try {
		createInitialContext();
		String hostname = getLocalHost().getHostName().toLowerCase();
		final UserTransaction userTransaction = getUserTransaction(hostname);
		XMLRemote bean = lookup(XMLRemote.class, "bank");
		assertEquals(STATUS_NO_TRANSACTION, bean.transactionStatus());

		try {
			userTransaction.begin();
			bean.transactionStatus();
			fail("the transaction is not supported");
		} catch (EJBException | IllegalStateException e) {
			logger.info("the transaction is not supported");
		}
	} finally {
		closeContext();
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:24,代码来源:XMLTestCase.java

示例8: verifyInjectedRawToken

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
    description = "Verify that the injected raw token claim is as expected")
public void verifyInjectedRawToken() throws Exception {
    Reporter.log("Begin verifyInjectedRawToken\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedRawToken";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam(Claims.raw_token.name(), token)
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:19,代码来源:PrimitiveInjectionTest.java

示例9: verifyExpiration

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_JWT,
        description = "Verify that the exp claim is as expected")
public void verifyExpiration() throws Exception {
    Reporter.log("Begin verifyExpiration\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyExpiration";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
            .target(uri)
            .queryParam(Claims.exp.name(), expClaim)
            .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:19,代码来源:RequiredClaimsTest.java

示例10: testExcludedClasses

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testExcludedClasses(String type) throws InterruptedException {
    vr = callEndpoint(type);
    vr.body("openapi", equalTo("3.0.0"));
    vr.body("info.title", equalTo("AirlinesRatingApp API"));
    vr.body("info.version", equalTo("1.0"));
    
    vr.body("paths.", aMapWithSize(10));
    vr.body("paths.'/reviews'", nullValue());
    vr.body("paths.'/reviews/{id}'", nullValue());
    vr.body("paths.'/reviews/{user}'", nullValue());
    vr.body("paths.'/reviews/{airline}'", nullValue());
    vr.body("paths.'/reviews/{user}/{airlines}'", nullValue());
    
    vr.body("paths.'/availability'", nullValue());

    
    
}
 
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:21,代码来源:OASConfigExcludeClassesTest.java

示例11: verifyInjectedSUB

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
    description = "Verify that the injected sub claim is as expected")
public void verifyInjectedSUB() throws Exception {
    Reporter.log("Begin verifyInjectedSUB\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedSUB";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam(Claims.sub.name(), "24400320")
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:19,代码来源:PrimitiveInjectionTest.java

示例12: verifyInjectedAudience

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
    description = "Verify that the injected aud claim is as expected")
public void verifyInjectedAudience() throws Exception {
    Reporter.log("Begin verifyInjectedAudience\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedAudience";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam(Claims.aud.name(), "s6BhdRkqt3")
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:19,代码来源:ProviderInjectionTest.java

示例13: verifyInjectedOptionalSubject

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
    description = "Verify that the injected sub claim is as expected")
public void verifyInjectedOptionalSubject() throws Exception {
    Reporter.log("Begin verifyInjectedOptionalSubject\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedOptionalSubject";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam(Claims.sub.name(), "24400320")
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:19,代码来源:ClaimValueInjectionTest.java

示例14: verifyInjectedCustomInteger

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
    description = "Verify that the injected customInteger claim is as expected")
public void verifyInjectedCustomInteger() throws Exception {
    Reporter.log("Begin verifyInjectedCustomInteger\n");
    String uri = baseURL.toExternalForm() + "/endp/verifyInjectedCustomInteger";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam("value", 123456789)
        .queryParam(Claims.auth_time.name(), authTimeClaim);
    Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:19,代码来源:ClaimValueInjectionTest.java

示例15: testTagDeclarations

import org.jboss.arquillian.container.test.api.RunAsClient; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testTagDeclarations(String type) {
    ValidatableResponse vr = callEndpoint(type);
    String tagsPath = "tags.find { it.name == '";
    String desc = "' }.description";
    vr.body(tagsPath + "user" + desc, equalTo("Operations about user"));
    vr.body(tagsPath + "create" + desc, equalTo("Operations about create"));
    vr.body(tagsPath + "Airlines" + desc, equalTo("All the airlines methods"));
    vr.body(tagsPath + "Availability" + desc, equalTo("All the availability methods"));
    vr.body(tagsPath + "Get Flights" + desc, equalTo("method to retrieve all flights available"));
    vr.body(tagsPath + "Get Flights" + "' }.externalDocs.description", equalTo("A list of all the flights offered by the app"));
    vr.body(tagsPath + "Get Flights" + "' }.externalDocs.url", equalTo("http://airlinesratingapp.com/ourflights"));
    vr.body(tagsPath + "Bookings" + desc, equalTo("All the bookings methods"));
    vr.body(tagsPath + "Get Airlines" + desc, equalTo("method to get all airlines"));
    vr.body(tagsPath + "Retrieve Airlines" + desc, equalTo("method to retrieve all airlines"));
}
 
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:18,代码来源:ModelReaderAppTest.java


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