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


Java SwitchYardTestKit类代码示例

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


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

示例1: testDeployment

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
@Override
@Test
public void testDeployment() throws Exception {
    ConnectionFactory cf = new ActiveMQConnectionFactory(AMQ_USER, AMQ_PASSWD, AMQ_BROKER_URL);
    Connection conn = cf.createConnection();

    try {
        Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        final MessageProducer producer = session.createProducer(session.createQueue(REQUEST_QUEUE));
        final MessageConsumer consumer = session.createConsumer(session.createQueue(REPLY_QUEUE));
        conn.start();

        producer.send(session.createObjectMessage(INPUT));

        Message message = consumer.receive(3000);
        String reply = ((TextMessage)message).getText();
        SwitchYardTestKit.compareXMLToString(reply, EXPECTED_REPLY);
    } finally {
        conn.close();
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:22,代码来源:BpelServiceJmsBindingQuickstartTest.java

示例2: testJmsBinding

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
@Test
public void testJmsBinding() throws Exception {
    HornetQMixIn hqMixIn = new HornetQMixIn(false)
                                .setUser(ResourceDeployer.USER)
                                .setPassword(ResourceDeployer.PASSWD);
    hqMixIn.initialize();
    
    Session session = null;
    MessageProducer producer = null;
    MessageConsumer consumer = null;
    try {
        session = hqMixIn.createJMSSession();
        producer = session.createProducer(HornetQMixIn.getJMSQueue(REQUEST_QUEUE));
        Message message = hqMixIn.createJMSMessage(INPUT);
        producer.send(message);

        consumer = session.createConsumer(HornetQMixIn.getJMSQueue(REPLY_QUEUE));
        message = consumer.receive(3000);
        String reply = hqMixIn.readStringFromJMSMessage(message);
        SwitchYardTestKit.compareXMLToString(reply, EXPECTED_REPLY);
    } finally {
        hqMixIn.uninitialize();
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:25,代码来源:BpelServiceJmsBindingQuickstartTest.java

示例3: setup

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
@BeforeClass
public static void setup() {
    namingMixIn = new NamingMixIn();
    transactionMixIn = new TransactionMixIn();
    cdiMixIn = new CDIMixIn();
    myTxMixInParticipant = new MyTransactionMixInParticipant(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            _transactionMixInParticipantInvoked = true;
            return null;
        }
    });
    List<TestMixIn> mixins = new ArrayList<TestMixIn>(Arrays.<TestMixIn>asList(namingMixIn,transactionMixIn,cdiMixIn,myTxMixInParticipant));
    SwitchYardTestKit testkit = mock(SwitchYardTestKit.class);
    when(testkit.getMixIns()).thenReturn(mixins);
    namingMixIn.setTestKit(testkit);
    transactionMixIn.setTestKit(testkit);
    cdiMixIn.setTestKit(testkit);
    myTxMixInParticipant.setTestKit(testkit);
    namingMixIn.initialize();
    transactionMixIn.initialize();
    cdiMixIn.initialize();
    myTxMixInParticipant.initialize();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:25,代码来源:CDIMixInWithTransactionTest.java

示例4: testHelloService

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
/**
 * Send a message to HelloRequestQueue and receive from HelloResponseQueue.
 */
@Test
public void testHelloService() throws Exception {
    Session session = _hqMixIn.getJMSSession();
    MessageProducer producer = session.createProducer(HornetQMixIn.getJMSQueue(REQUEST_NAME));
    Message message = _hqMixIn.createJMSMessage(createPayload(NAME));
    producer.send(message);

    MessageConsumer consumer = session.createConsumer(HornetQMixIn.getJMSQueue(REPLY_NAME));
    message = consumer.receive(3000);
    String reply = _hqMixIn.readStringFromJMSMessage(message);
    SwitchYardTestKit.compareXMLToString(reply, createExpectedReply(NAME));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:16,代码来源:JmsBindingTest.java

示例5: init

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
@org.junit.Before
public void init() {
	try {
		_testKit = new SwitchYardTestKit(this);
		_testKit.start();
	} catch(Exception e) {
		e.printStackTrace();
		fail("Unable to initialize testkit: "+ e);
	}
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:11,代码来源:BPELInOnlyLocatorTest.java

示例6: init

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
@org.junit.Before
public void init() {
	try {
		_testKit = new SwitchYardTestKit(this);
		_testKit.start();
	} catch(Exception e) {
		fail("Unable to initialize testkit");
	}
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:10,代码来源:BPELSayHelloTest.java

示例7: orderServiceRESTEndpoint

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
/**
 * This Quickstart test exclusively uses Netty server due to buggy JDK HttpServer.
 * See https://issues.jboss.org/browse/RESTEASY-734
 */
@Test
public void orderServiceRESTEndpoint() throws Exception {

    // Create our inventory
    String response = null;
    response = http.sendString(BASE_URL + "/inventory/create", "", HTTPMixIn.HTTP_OPTIONS);
    Assert.assertEquals(SUCCESS, response);
    /* WarehouseResource warehouseProxy = ProxyFactory.create(WarehouseResource.class, BASE_URL);
    warehouseProxy.addItem(new Item(1, "Hydrogen Atom - No, we are not kidding!"));
    warehouseProxy.addItem(new Item(2, "Handcrafted Copper Plate"));
    warehouseProxy.addItem(new Item(3, "Einstein's Bust - Talks about your future :)"));
    warehouseProxy.addItem(new Item(4, "Time Machine"));*/

    // Create an order
    response = http.sendString(BASE_URL + "/order", "", HTTPMixIn.HTTP_POST);

    SwitchYardTestKit.compareXMLToString(response, ORDER);

    // Add a new item or update order
    response = http.sendString(BASE_URL + "/order/item", ORDER1, HTTPMixIn.HTTP_PUT);
    Assert.assertEquals(SUCCESS, response);

    // Add some more items or update order
    response = http.sendString(BASE_URL + "/order/item", ORDER2, HTTPMixIn.HTTP_PUT);
    Assert.assertEquals(SUCCESS, response);

    // Look at our order
    response = http.sendString(BASE_URL + "/order/1", "", HTTPMixIn.HTTP_GET);
    SwitchYardTestKit.compareXMLToString(response, ORDER3);

    // Delete the first item
    response = http.sendString(BASE_URL + "/order/1:1", "", HTTPMixIn.HTTP_DELETE);
    Assert.assertEquals(SUCCESS, response);

    // Try to delete item with wrong composite ID
    int status = http.sendStringAndGetStatus(BASE_URL + "/order/1", "", HTTPMixIn.HTTP_DELETE);
    Assert.assertEquals(400, status);

    // Look at our order
    response = http.sendString(BASE_URL + "/order/1", "", HTTPMixIn.HTTP_GET);
    SwitchYardTestKit.compareXMLToString(response, ORDER4);

    // Update item descriptions in our inventory
    response = http.sendString(BASE_URL + "/inventory/update", "", HTTPMixIn.HTTP_OPTIONS);
    Assert.assertEquals(SUCCESS, response);

    // Look at our order
    response = http.sendString(BASE_URL + "/order/1", "", HTTPMixIn.HTTP_GET);
    SwitchYardTestKit.compareXMLToString(response, ORDER5);

    // Look at non existing order
    status = http.sendStringAndGetStatus(BASE_URL + "/order/" + Integer.MAX_VALUE, "", HTTPMixIn.HTTP_GET);
    Assert.assertEquals(404, status);

    // Get item
    status = http.sendStringAndGetStatus(BASE_URL + "/warehouse/get/26", "", HTTPMixIn.HTTP_GET);
    Assert.assertEquals(404, status);

    // Destroy our inventory
    response = http.sendString(BASE_URL + "/inventory/remove", "", HTTPMixIn.HTTP_OPTIONS);
    Assert.assertEquals(SUCCESS, response);

    // Test 404 returned with complete url
    response = http.sendString(BASE_URL + "/order/404", "", HTTPMixIn.HTTP_GET);
    Assert.assertTrue(response.contains("Error at [http://localhost:8081/404/404/]"));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:71,代码来源:RESTEasyBindingTest.java

示例8: setTestKit

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
@Override
public void setTestKit(SwitchYardTestKit kit) {
    this._kit = kit;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:5,代码来源:AbstractTestMixIn.java

示例9: getTestKit

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
/**
 * Get the test kit instance associated with the test mixin.
 * @return The test kit instance instance.
 */
public SwitchYardTestKit getTestKit() {
    return _kit;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:8,代码来源:AbstractTestMixIn.java

示例10: postStringAndTestXML

import org.switchyard.test.SwitchYardTestKit; //导入依赖的package包/类
/**
 * POST the specified String request to the specified HTTP endpoint and perform an XML compare
 * between the HTTP response and the specified expected response String.
 * @param endpointURL The HTTP endpoint URL.
 * @param request The classpath resource to be posted to the endpoint.
 * @param expectedResponse The String to use to perform the XML test on the response.
 * @return The HTTP response payload.
 */
public String postStringAndTestXML(String endpointURL, String request, String expectedResponse) {
    String response = postString(endpointURL, request);
    SwitchYardTestKit.compareXMLToString(response, expectedResponse);
    return response;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:14,代码来源:HTTPMixIn.java


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