• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TestPortProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testGsonConfig

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@SuppressWarnings("static-access")
@Test
public void testGsonConfig() {

	Client client = ResteasyClientBuilder.newClient(); // Avoid conflict with Jersey in classpath
	// ClientBuilder.newClient()

	String pong = client.target(TestPortProvider.generateURL("/test/ping")).request().get(String.class);
	assertEquals("pong", pong);

	PropertyBox box = SET.execute(() -> client.target(TestPortProvider.generateURL("/test/data/{num}"))
			.resolveTemplate("num", 1).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(1), box.getValue(NUM));
	assertEquals("Str_1", box.getValue(STR));

	box = SET.execute(
			() -> client.target(TestPortProvider.generateURL("/test/data/2")).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(2), box.getValue(NUM));
	assertEquals("Str_2", box.getValue(STR));

}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:24,代码来源:TestResteasyServicesIntegration.java


示例2: testMetadataVisibility

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
public void testMetadataVisibility() throws Exception {
    Client client = mockClient2();
    MockProvider.CLIENT = client;
    
    StringWriter sw = new StringWriter();
    
    EdmxFormatWriter.write(client.getMetadata(), sw);
    
    ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/$metadata"));
    ClientResponse<String> response = request.get(String.class);
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals(sw.toString(), response.getEntity());  
    String edm = "<?xml version=\"1.0\" encoding=\"utf-8\"?><edmx:Edmx Version=\"1.0\" xmlns:edmx=\"http://schemas.microsoft.com/ado/2007/06/edmx\"><edmx:DataServices m:DataServiceVersion=\"2.0\" xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"></edmx:DataServices></edmx:Edmx>";
    Assert.assertEquals(edm, response.getEntity());
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:17,代码来源:TestODataIntegration.java


示例3: testProjectedColumns

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
public void testProjectedColumns() throws Exception {
	Client client = mockClient();
	MockProvider.CLIENT = client;
	ArgumentCaptor<Query> sql = ArgumentCaptor.forClass(Query.class);
	ArgumentCaptor<EdmEntitySet> entitySet = ArgumentCaptor.forClass(EdmEntitySet.class);
	
	OEntity entity = createCustomersEntity(client.getMetadata());
	ArrayList<OEntity> list = new ArrayList<OEntity>();
	list.add(entity);
	
	EntityList result = Mockito.mock(EntityList.class);
	when(result.get(0)).thenReturn(entity);
	when(result.size()).thenReturn(1);
	when(result.iterator()).thenReturn(list.iterator());
	
	when(client.executeSQL(any(Query.class), anyListOf(SQLParam.class), any(EdmEntitySet.class), (LinkedHashMap<String, Boolean>) any(), any(QueryInfo.class))).thenReturn(result);
	
       ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/Customers?$select=CustomerID,CompanyName,Address"));
       ClientResponse<String> response = request.get(String.class);
       verify(client).executeSQL(sql.capture(),  anyListOf(SQLParam.class), entitySet.capture(), (LinkedHashMap<String, Boolean>) any(), any(QueryInfo.class));
       
       Assert.assertEquals("SELECT g0.CustomerID, g0.CompanyName, g0.Address FROM nw.Customers AS g0 ORDER BY g0.CustomerID", sql.getValue().toString());
       Assert.assertEquals(200, response.getStatus());
       //Assert.assertEquals("", response.getEntity());		
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:27,代码来源:TestODataIntegration.java


示例4: testProcedure

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
public void testProcedure() throws Exception {
	Client client = mockClient();
	MockProvider.CLIENT = client;
	ArgumentCaptor<String> sql = ArgumentCaptor.forClass(String.class);
	ArgumentCaptor<List> params = ArgumentCaptor.forClass(List.class);
	
	when(client.executeCall(any(String.class), anyListOf(SQLParam.class), any(EdmType.class))).thenReturn(Responses.simple(EdmSimpleType.INT32, "return", null));
	
       ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/getCustomers?p2=datetime'2011-09-11T00:00:00'&p3=2.0M"));
       ClientResponse<String> response = request.get(String.class);
       verify(client).executeCall(sql.capture(), params.capture(), any(EdmType.class));
       
       Assert.assertEquals("{? = call nw.getCustomers(p2=>?,p3=>?)}", sql.getValue().toString());
       Assert.assertEquals(TimestampUtil.createTimestamp(111, 8, 11, 0, 0, 0, 0), ((SQLParam)params.getValue().get(0)).value);
       Assert.assertEquals(BigDecimal.valueOf(2.0), ((SQLParam)params.getValue().get(1)).value);
       Assert.assertEquals(200, response.getStatus());
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:19,代码来源:TestODataIntegration.java


示例5: testSelect

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
public void testSelect() throws Exception {
	Client client = mockClient();
	MockProvider.CLIENT = client;
	ArgumentCaptor<Query> sql = ArgumentCaptor.forClass(Query.class);
	ArgumentCaptor<EdmEntitySet> entitySet = ArgumentCaptor.forClass(EdmEntitySet.class);
	
	OEntity entity = createCustomersEntity(client.getMetadata());
	ArrayList<OEntity> list = new ArrayList<OEntity>();
	list.add(entity);
	
	EntityList result = Mockito.mock(EntityList.class);
	when(result.get(0)).thenReturn(entity);
	when(result.size()).thenReturn(1);
	when(result.iterator()).thenReturn(list.iterator());
	
	when(client.executeSQL(any(Query.class), anyListOf(SQLParam.class), any(EdmEntitySet.class), (LinkedHashMap<String, Boolean>) any(), any(QueryInfo.class))).thenReturn(result);
	
       ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/Customers?$select=CustomerID,CompanyName,Address"));
       ClientResponse<String> response = request.get(String.class);
       verify(client).executeSQL(sql.capture(),  anyListOf(SQLParam.class), entitySet.capture(), (LinkedHashMap<String, Boolean>) any(), any(QueryInfo.class));
       
       Assert.assertEquals("SELECT g0.CustomerID, g0.CompanyName, g0.Address FROM nw.Customers AS g0 ORDER BY g0.CustomerID", sql.getValue().toString());
       Assert.assertEquals(200, response.getStatus());
       
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:27,代码来源:TestODataIntegration.java


示例6: testGsonConfig

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@SuppressWarnings("static-access")
@Test
public void testGsonConfig() {

	Client client = ResteasyClientBuilder.newClient() // Avoid conflict with Jersey in classpath
			// ClientBuilder.newClient()
			.register(JacksonFeature.class);

	String pong = client.target(TestPortProvider.generateURL("/test/ping")).request().get(String.class);
	assertEquals("pong", pong);

	PropertyBox box = SET.execute(() -> client.target(TestPortProvider.generateURL("/test/data/{num}"))
			.resolveTemplate("num", 1).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(1), box.getValue(NUM));
	assertEquals("Str_1", box.getValue(STR));

	box = SET.execute(
			() -> client.target(TestPortProvider.generateURL("/test/data/2")).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(2), box.getValue(NUM));
	assertEquals("Str_2", box.getValue(STR));
	
	
	PropertyBox boxToSrlz = PropertyBox.builder(SET).set(NUM, 100).build();
	
	Response response = client.target(TestPortProvider.generateURL("/test/srlz")).request()
			.put(Entity.entity(boxToSrlz, MediaType.APPLICATION_JSON));
	assertNotNull(response);
	assertEquals(Status.ACCEPTED.getStatusCode(), response.getStatus());

}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:33,代码来源:TestResteasyIntegration.java


示例7: testGsonConfig

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@SuppressWarnings("static-access")
@Test
public void testGsonConfig() {

	Client client = ResteasyClientBuilder.newClient(); // Avoid conflict with Jersey in classpath
	// ClientBuilder.newClient();

	String pong = client.target(TestPortProvider.generateURL("/test/ping")).request().get(String.class);
	assertEquals("pong", pong);

	PropertyBox box = SET.execute(() -> client.target(TestPortProvider.generateURL("/test/data/{num}"))
			.resolveTemplate("num", 1).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(1), box.getValue(NUM));
	assertEquals("Str_1", box.getValue(STR));

	box = SET.execute(
			() -> client.target(TestPortProvider.generateURL("/test/data/2")).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(2), box.getValue(NUM));
	assertEquals("Str_2", box.getValue(STR));

	PropertyBox boxToSrlz = PropertyBox.builder(SET).set(NUM, 100).set(DBL, 77.7).build();

	Response response = client.target(TestPortProvider.generateURL("/test/srlz")).request()
			.put(Entity.entity(boxToSrlz, MediaType.APPLICATION_JSON));
	assertNotNull(response);
	assertEquals(Status.ACCEPTED.getStatusCode(), response.getStatus());

}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:31,代码来源:TestResteasyServicesIntegration.java


示例8: testGsonConfig

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@SuppressWarnings("static-access")
@Test
public void testGsonConfig() {

	Client client = ResteasyClientBuilder.newClient() // Avoid conflict with Jersey in classpath
			// ClientBuilder.newClient()
			.register(GsonFeature.class);

	String pong = client.target(TestPortProvider.generateURL("/test/ping")).request().get(String.class);
	assertEquals("pong", pong);

	PropertyBox box = SET.execute(() -> client.target(TestPortProvider.generateURL("/test/data/{num}"))
			.resolveTemplate("num", 1).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(1), box.getValue(NUM));
	assertEquals("Str_1", box.getValue(STR));

	box = SET.execute(
			() -> client.target(TestPortProvider.generateURL("/test/data/2")).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(2), box.getValue(NUM));
	assertEquals("Str_2", box.getValue(STR));

	PropertyBox boxToSrlz = PropertyBox.builder(SET).set(NUM, 100).set(DBL, 77.7).build();

	Response response = client.target(TestPortProvider.generateURL("/test/srlz")).request()
			.put(Entity.entity(boxToSrlz, MediaType.APPLICATION_JSON));
	assertNotNull(response);
	assertEquals(Status.ACCEPTED.getStatusCode(), response.getStatus());

}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:32,代码来源:TestResteasyIntegrationContext.java


示例9: testGsonConfig

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@SuppressWarnings("static-access")
@Test
public void testGsonConfig() {

	Client client = ResteasyClientBuilder.newClient() // Avoid conflict with Jersey in classpath
			// ClientBuilder.newClient()
			.register(GsonFeature.class);

	String pong = client.target(TestPortProvider.generateURL("/test/ping")).request().get(String.class);
	assertEquals("pong", pong);

	PropertyBox box = SET.execute(() -> client.target(TestPortProvider.generateURL("/test/data/{num}"))
			.resolveTemplate("num", 1).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(1), box.getValue(NUM));
	assertEquals("Str_1", box.getValue(STR));

	box = SET.execute(
			() -> client.target(TestPortProvider.generateURL("/test/data/2")).request().get(PropertyBox.class));
	assertNotNull(box);
	assertEquals(Integer.valueOf(2), box.getValue(NUM));
	assertEquals("Str_2", box.getValue(STR));

	PropertyBox boxToSrlz = PropertyBox.builder(SET).set(NUM, 100).set(DBL, 77.7).build();

	Response response = client.target(TestPortProvider.generateURL("/test/srlz")).request()
			.put(Entity.entity(boxToSrlz, MediaType.APPLICATION_JSON));
	assertNotNull(response);
	assertEquals(Status.ACCEPTED.getStatusCode(), response.getStatus());
	
	// check cache
	response = client.target(TestPortProvider.generateURL("/test/srlz")).request()
			.put(Entity.entity(boxToSrlz, MediaType.APPLICATION_JSON));
	assertNotNull(response);
	assertEquals(Status.ACCEPTED.getStatusCode(), response.getStatus());

}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:38,代码来源:TestResteasyIntegration.java


示例10: test001

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
void test001() {
  final String generateBasicReqURL = TestPortProvider.generateURL("/rest" + "/api");
  System.out.println("generateBasicReqURL = " + generateBasicReqURL);
  Client client = ClientBuilder.newClient();
  final Invocation.Builder request = client
      .target(generateBasicReqURL)
      .path("add")
      .queryParam("inputA", "1")
      .queryParam("inputB", "1")
      .request();
  final Response response = request.get();
  Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
  Assert.assertEquals("2", response.readEntity(String.class));
}
 
开发者ID:Java-Publications,项目名称:javamagazin-009-microkernel,代码行数:16,代码来源:ServiceRESTTest.java


示例11: test001

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
void test001() {
  final String generateBasicReqURL = TestPortProvider.generateURL("/rest" + "/security");
  System.out.println("generateBasicReqURL = " + generateBasicReqURL);
  Client client = ClientBuilder.newClient();
  final Invocation.Builder request = client
      .target(generateBasicReqURL)
      .path("check")
      .queryParam("username", "admin")
      .queryParam("password", "admin")
      .request();
  final Response response = request.get();
  Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
  Assert.assertEquals("true", response.readEntity(String.class));
}
 
开发者ID:Java-Publications,项目名称:javamagazin-009-microkernel,代码行数:16,代码来源:LoginRestTest.java


示例12: testMetadata

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
public void testMetadata() throws Exception {
	Client client = mockClient();
	MockProvider.CLIENT = client;
	
	StringWriter sw = new StringWriter();
	
	EdmxFormatWriter.write(client.getMetadata(), sw);
	
       ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/$metadata"));
       ClientResponse<String> response = request.get(String.class);
       Assert.assertEquals(200, response.getStatus());
       Assert.assertEquals(sw.toString(), response.getEntity());
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:15,代码来源:TestODataIntegration.java


示例13: testError

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
public void testError() throws Exception {
	Client client = mockClient();
	MockProvider.CLIENT = client;
	
	when(client.executeSQL(any(Query.class), anyListOf(SQLParam.class), any(EdmEntitySet.class), (LinkedHashMap<String, Boolean>) any(), any(QueryInfo.class))).thenThrow(new NullPointerException());
	
       ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/Customers?$select=CustomerID,CompanyName,Address"));
       ClientResponse<String> response = request.get(String.class);
       
       Assert.assertEquals(500, response.getStatus());
       Assert.assertTrue(response.getEntity().endsWith("<error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"><code>ServerErrorException</code><message lang=\"en-US\">Internal Server Error</message></error>"));
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:14,代码来源:TestODataIntegration.java


示例14: testInvalidCharacterReplacement

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test public void testInvalidCharacterReplacement() throws Exception {
	EmbeddedServer es = new EmbeddedServer();
	es.start(new EmbeddedConfiguration());
	try {
		ModelMetaData mmd = new ModelMetaData();
		mmd.setName("vw");
		mmd.setSchemaSourceType("ddl");
		mmd.setModelType(Type.VIRTUAL);
		mmd.setSchemaText("create view x (a string primary key, b char, c string[], d integer) as select 'ab\u0000cd\u0001', char(22), ('a\u00021','b1'), 1;");
		es.deployVDB("northwind", mmd);
		
		TeiidDriver td = es.getDriver();
		Properties props = new Properties();
		props.setProperty(LocalClient.INVALID_CHARACTER_REPLACEMENT, " ");
		LocalClient lc = new LocalClient("northwind", 1, props);
		lc.setDriver(td);
		MockProvider.CLIENT = lc;
		
        ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/x"));
        ClientResponse<String> response = request.get(String.class);
        Assert.assertEquals(200, response.getStatus());
        assertTrue(response.getEntity().contains("ab cd "));
        assertTrue(response.getEntity().contains("a 1"));
	} finally {
		es.stop();
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:28,代码来源:TestODataIntegration.java


示例15: testNoSkipToken

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test public void testNoSkipToken() throws Exception {
    EmbeddedServer es = new EmbeddedServer();
    es.start(new EmbeddedConfiguration());
    try {
        ModelMetaData mmd = new ModelMetaData();
        mmd.setName("vw");
        mmd.setSchemaSourceType("ddl");
        mmd.setModelType(Type.VIRTUAL);
        mmd.setSchemaText("create view x (a string primary key, b integer) as select 'xyz', 123 union all select 'abc', 456;");
        es.deployVDB("northwind", mmd);
        
        TeiidDriver td = es.getDriver();
        Properties props = new Properties();
        props.setProperty("batch-size", "0");
        LocalClient lc = new LocalClient("northwind", 1, props);
        lc.setDriver(td);
        MockProvider.CLIENT = lc;
        
        ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/x?$format=json"));
        ClientResponse<String> response = request.get(String.class);
        assertEquals(200, response.getStatus());
        JSONParser parser = new JSONParser();
        JSONValueExtractor contentHandler = new JSONValueExtractor("__next");
        parser.parse(response.getEntity(), contentHandler);
        assertNotNull(contentHandler.next);
        assertTrue(response.getEntity().contains("abc"));
        assertTrue(response.getEntity().contains("xyz"));
        
        assertNull(contentHandler.value);
    } finally {
        es.stop();
    }
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:34,代码来源:TestODataIntegration.java


示例16: testBatch

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test public void testBatch() throws Exception {
	EmbeddedServer es = new EmbeddedServer();
	HardCodedExecutionFactory hc = new HardCodedExecutionFactory() {
		@Override
		public boolean supportsCompareCriteriaEquals() {
			return true;
		}
	};
	hc.addUpdate("DELETE FROM x WHERE x.a = 'a' AND x.b = 'b'", new int[] {1});
	es.addTranslator("x", hc);
	es.start(new EmbeddedConfiguration());
	try {
		ModelMetaData mmd = new ModelMetaData();
		mmd.setName("m");
		mmd.setSchemaSourceType("ddl");
		mmd.setSchemaText("create foreign table x (a string, b string, c integer, primary key (a, b)) options (updatable true);");
		mmd.addSourceMapping("x", "x", null);
		es.deployVDB("northwind", mmd);
		
		TeiidDriver td = es.getDriver();
		Properties props = new Properties();
		LocalClient lc = new LocalClient("northwind", 1, props);
		lc.setDriver(td);
		MockProvider.CLIENT = lc;
		
		String post = "Content-Type: application/http\n"
				+ "Content-Transfer-Encoding:binary\n"
				+ "\nDELETE /odata/northwind/x(a='a',b='b') HTTP/1.1\n"
				//+ "Host: host\n"
				+ "--batch_36522ad7-fc75-4b56-8c71-56071383e77b\n";
		
        ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/Customers/$batch"));
        request.body(ODataBatchProvider.MULTIPART_MIXED, post); 
		
        ClientResponse<String> response = request.post(String.class);
        assertEquals(202, response.getStatus());
	} finally {
		es.stop();
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:41,代码来源:TestODataIntegration.java


示例17: testJsonProcedureResultSet

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test public void testJsonProcedureResultSet() throws Exception {
	EmbeddedServer es = new EmbeddedServer();
	HardCodedExecutionFactory hc = new HardCodedExecutionFactory();
	hc.addData("EXEC x()", Arrays.asList(Arrays.asList("x"), Arrays.asList("y")));
	es.addTranslator("x", hc);
	es.start(new EmbeddedConfiguration());
	try {
		ModelMetaData mmd = new ModelMetaData();
		mmd.setName("m");
		mmd.setSchemaSourceType("ddl");
		mmd.setSchemaText("create foreign procedure x () returns table(y string);");
		mmd.addSourceMapping("x", "x", null);
		es.deployVDB("northwind", mmd);
		
		TeiidDriver td = es.getDriver();
		Properties props = new Properties();
		LocalClient lc = new LocalClient("northwind", 1, props);
		lc.setDriver(td);
		MockProvider.CLIENT = lc;
		
        ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/odata/northwind/x?$format=json"));
        ClientResponse<String> response = request.get(String.class);
        assertEquals(200, response.getStatus());
	} finally {
		es.stop();
	}
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:28,代码来源:TestODataIntegration.java


示例18: EmbeddedRestActiveMQ

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
EmbeddedRestActiveMQ(ConnectionFactoryOptions jmsOptions) {
   int port = TestPortProvider.getPort();
   tjws.setPort(port);
   tjws.setRootResourcePath("");
   tjws.setSecurityDomain(null);
   manager = new MessageServiceManager(jmsOptions);
   initEmbeddedActiveMQ();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:EmbeddedRestActiveMQ.java


示例19: startEmbedded

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@BeforeClass
public static void startEmbedded() throws Exception {
   server = new EmbeddedRestActiveMQJMS(null);
   assertNotNull(server.embeddedActiveMQ);
   server.getManager().setConfigResourcePath("activemq-rest.xml");

   SecurityConfiguration securityConfiguration = createDefaultSecurityConfiguration();
   ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfiguration);
   server.getEmbeddedJMS().setSecurityManager(securityManager);

   server.start();
   List<String> connectors = createInVmConnector();
   server.getEmbeddedJMS().getJMSServerManager().createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");

   ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/queues/exampleQueue"));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   assertEquals(200, response.getStatus());
   Link sender = response.getLinkHeader().getLinkByTitle("create");
   System.out.println("create: " + sender);
   Link consumers = response.getLinkHeader().getLinkByTitle("pull-consumers");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, true);
   consumeNext = response.getLinkHeader().getLinkByTitle("consume-next");
   System.out.println("consume-next: " + consumeNext);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:28,代码来源:EmbeddedRestActiveMQJMSTest.java


示例20: testFindQueue

import org.jboss.resteasy.test.TestPortProvider; //导入依赖的package包/类
@Test
public void testFindQueue() throws Exception {
   String testName = "testFindQueue";
   server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(testName), RoutingType.MULTICAST));
   server.getActiveMQServer().createQueue(new SimpleString(testName), RoutingType.MULTICAST, new SimpleString(testName), null, false, false);

   ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/queues/" + testName));

   ClientResponse<?> response = request.head();
   response.releaseConnection();
   Assert.assertEquals(200, response.getStatus());
   Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
   System.out.println("create: " + sender);
   Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
   System.out.println("pull: " + consumers);
   response = Util.setAutoAck(consumers, true);
   Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
   System.out.println("poller: " + consumeNext);

   ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
   res.releaseConnection();
   Assert.assertEquals(201, res.getStatus());

   res = consumeNext.request().post(String.class);
   Assert.assertEquals(200, res.getStatus());
   Assert.assertEquals("1", res.getEntity(String.class));
   res.releaseConnection();
   Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
   System.out.println("session: " + session);
   Assert.assertEquals(204, session.request().delete().getStatus());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:32,代码来源:FindDestinationTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Feature类代码示例发布时间:2022-05-22
下一篇:
Java GenLayerShore类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap