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


Java HttpTester.setVersion方法代码示例

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


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

示例1: servletOutput

import org.eclipse.jetty.testing.HttpTester; //导入方法依赖的package包/类
@Test
public void servletOutput() throws Exception {
  ServletTester container = new ServletTester();
  container.setContextPath("/context");
  container.addServlet(HelloServlet.class, "/*");
  container.start();

  HttpTester request = new HttpTester();
  request.setMethod("GET");
  request.setURI("/context/foo/bar");
  request.setVersion("HTTP/1.0");

  HttpTester response = new HttpTester();
  response.parse(container.getResponses(request.generate()));

  assertEquals(200, response.getStatus());
  assertEquals("Servlet says Hello!\npathinfo = /foo/bar\n", response.getContent());
  assertEquals("text/plain;charset=UTF-8", response.getHeader("Content-Type"));

  container.stop();
}
 
开发者ID:bitmelt,项目名称:maven-servlet-template,代码行数:22,代码来源:HelloServletTest.java

示例2: testGetRootServlet

import org.eclipse.jetty.testing.HttpTester; //导入方法依赖的package包/类
@Test
public void testGetRootServlet() {
  HttpTester request = new HttpTester();
  HttpTester response = new HttpTester();
  request.setMethod( "GET" );
  request.setHeader( "Host", "tester" );
  request.setURI( GetRootServlet.CONTEXT_PATH );
  request.setVersion( "HTTP/1.0" );
  try {
    response.parse( tester.getResponses( request.generate() ) );

    Node document = parse( response.getContent() );
    String title = BaseMessages.getString( GetRootServlet.class, "GetRootServlet.KettleSlaveServer.Title" );
    Assert.assertEquals( title, findTextNode( document, "TITLE" ).getTextContent() );
    String menu = BaseMessages.getString( GetRootServlet.class, "GetRootServlet.SlaveServerMenu" );
    Assert.assertEquals( menu, findTextNode( document, "H2" ).getTextContent() );
    String status = BaseMessages.getString( GetRootServlet.class, "GetRootServlet.ShowStatus" );
    Assert.assertEquals( status, findTextNode( document, "A" ).getTextContent() );

  } catch ( Exception ex ) {
    ex.printStackTrace();
    Assert.fail( ex.getMessage() );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:CarteIT.java

示例3: testGetStatusServlet

import org.eclipse.jetty.testing.HttpTester; //导入方法依赖的package包/类
@Test
public void testGetStatusServlet() {
  HttpTester request = new HttpTester();
  HttpTester response = new HttpTester();
  request.setMethod( "GET" );
  request.setHeader( "Host", "tester" );
  request.setURI( GetStatusServlet.CONTEXT_PATH + "?xml=Y" );
  request.setVersion( "HTTP/1.0" );
  try {
    response.parse( tester.getResponses( request.generate() ) );
    // just test if we actually can create a SlaveServerStatus from the webservice
    // and that it is the same going in as out
    String xml =
      XMLHandler.getXMLHeader( Const.XML_ENCODING )
        + SlaveServerStatus.fromXML( response.getContent() ).getXML();
    Assert.assertEquals( response.getContent().trim(), xml.trim() );
  } catch ( Exception ex ) {
    ex.printStackTrace();
    Assert.fail( ex.getMessage() );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:22,代码来源:CarteIT.java

示例4: getStatus

import org.eclipse.jetty.testing.HttpTester; //导入方法依赖的package包/类
public SlaveServerStatus getStatus() {
  HttpTester request = new HttpTester();
  HttpTester response = new HttpTester();
  request.setMethod( "GET" );
  request.setHeader( "Host", "tester" );
  request.setURI( GetStatusServlet.CONTEXT_PATH + "?xml=Y" );
  request.setVersion( "HTTP/1.0" );
  try {
    response.parse( tester.getResponses( request.generate() ) );
    return SlaveServerStatus.fromXML( response.getContent() );
  } catch ( Exception ex ) {
    ex.printStackTrace();
  }
  return null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:16,代码来源:CarteIT.java

示例5: testAddTransServlet

import org.eclipse.jetty.testing.HttpTester; //导入方法依赖的package包/类
@Test
public void testAddTransServlet() {

  HttpTester request = new HttpTester();
  HttpTester response = new HttpTester();
  request.setMethod( "GET" );
  request.setHeader( "Host", "tester" );
  request.setURI( RegisterTransServlet.CONTEXT_PATH + "?xml=Y" );
  request.setVersion( "HTTP/1.0" );
  try {

    TransExecutionConfiguration transExecConfig = new TransExecutionConfiguration();
    Trans trans = CarteIT.generateTestTransformation();
    TransConfiguration transConfig = new TransConfiguration( trans.getTransMeta(), transExecConfig );
    request.setContent( transConfig.getXML() );
    response.parse( tester.getResponses( request.generate() ) );

    Document document = XMLHandler.loadXMLString( response.getContent() );
    NodeList nodes = document.getElementsByTagName( "result" );
    Assert.assertEquals( 1, nodes.getLength() );
    Assert.assertEquals( WebResult.STRING_OK, nodes.item( 0 ).getTextContent() );

    SlaveServerStatus status = getStatus();
    SlaveServerTransStatus transStatus = status.findTransStatus( trans.getName(), null ); // find the first one
    Assert.assertNotNull( transStatus );
    Assert.assertFalse( transStatus.isPaused() );
    Assert.assertFalse( transStatus.isRunning() );

  } catch ( Exception ex ) {
    ex.printStackTrace();
    Assert.fail( ex.getMessage() );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:34,代码来源:CarteIT.java

示例6: testStartTransServlet

import org.eclipse.jetty.testing.HttpTester; //导入方法依赖的package包/类
@Test
public void testStartTransServlet() {

  // add our test transformation
  testAddTransServlet();

  HttpTester request = new HttpTester();
  HttpTester response = new HttpTester();
  request.setMethod( "GET" );
  request.setHeader( "Host", "tester" );
  request.setURI( StartTransServlet.CONTEXT_PATH + "?xml=Y&name=CarteUnitTest" );
  request.setVersion( "HTTP/1.0" );
  try {
    response.parse( tester.getResponses( request.generate() ) );

    Document document = XMLHandler.loadXMLString( response.getContent() );
    NodeList nodes = document.getElementsByTagName( "result" );
    Assert.assertEquals( 1, nodes.getLength() );
    Assert.assertEquals( WebResult.STRING_OK, nodes.item( 0 ).getTextContent() );

    SlaveServerStatus status = getStatus();
    SlaveServerTransStatus transStatus = status.findTransStatus( "CarteUnitTest", null );
    Assert.assertNotNull( transStatus );
    Assert.assertFalse( transStatus.isPaused() );
    Assert.assertTrue( transStatus.isRunning() );

  } catch ( Exception ex ) {
    ex.printStackTrace();
    Assert.fail( ex.getMessage() );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:CarteIT.java

示例7: testPauseTransServlet

import org.eclipse.jetty.testing.HttpTester; //导入方法依赖的package包/类
@Test
public void testPauseTransServlet() {

  // add our test transformation
  testAddTransServlet();
  // start our test transformation
  testStartTransServlet();

  HttpTester request = new HttpTester();
  HttpTester response = new HttpTester();
  request.setMethod( "GET" );
  request.setHeader( "Host", "tester" );
  request.setURI( PauseTransServlet.CONTEXT_PATH + "?xml=Y&name=CarteUnitTest" );
  request.setVersion( "HTTP/1.0" );
  try {

    SlaveServerStatus status = getStatus();
    SlaveServerTransStatus transStatus = status.findTransStatus( "CarteUnitTest", null );
    Assert.assertNotNull( transStatus );
    // let's make sure that it is not paused
    Assert.assertFalse( transStatus.isPaused() );

    response.parse( tester.getResponses( request.generate() ) );

    Document document = XMLHandler.loadXMLString( response.getContent() );
    NodeList nodes = document.getElementsByTagName( "result" );
    Assert.assertEquals( 1, nodes.getLength() );
    Assert.assertEquals( WebResult.STRING_OK, nodes.item( 0 ).getTextContent() );

    status = getStatus();
    transStatus = status.findTransStatus( "CarteUnitTest", null );
    Assert.assertNotNull( transStatus );
    // now check to be sure it is paused
    Assert.assertTrue( transStatus.isPaused() );

  } catch ( Exception ex ) {
    ex.printStackTrace();
    Assert.fail( ex.getMessage() );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:41,代码来源:CarteIT.java


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