`
kkcheng
  • 浏览: 40856 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

jersery test

 
阅读更多

<dependencies>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.28</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>0.9.28</version>
</dependency>
<dependency>
<groupId>com.googlecode.ehcache-spring-annotations</groupId>
<artifactId>ehcache-spring-annotations</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
<!-- Jersey + Spring -->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>1.9</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>${org.jbehave-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>jdbc.SQLServerDriver</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.9</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
  <artifactId>commons-beanutils</artifactId>
  <version>1.8.3</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.sun.grizzly</groupId>
<artifactId>grizzly-servlet-webserver</artifactId>
<version>1.9.18-i</version>
<type>pom</type>
</dependency>

<!-- Jersey Test -->

<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-test-framework</artifactId>
<version>1.9-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly2</artifactId>
<version>1.9-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-core</artifactId>
<version>1.9-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<finalName>aaa</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/version.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/version.txt</exclude>
</excludes>
</resource>
</resources>
        <plugins>
        <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<copy file="${project.build.outputDirectory}/version.txt"
toFile="${project.build.directory}/${project.artifactId}/version/version.txt" overwrite="true" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.2</version>
</plugin>
</plugins>
</reporting>
</project>





public class JerseyTestSample extends JerseyTest {

public JerseyTestSample() throws Exception {
super(new WebAppDescriptor.Builder("com.morningstar.cms.resources")
.contextPath("contentservice")
.contextParam("contextConfigLocation", "classpath:spring/applicationContext-test-*.xml")
             .servletClass(SpringServlet.class)
             .contextListenerClass(ContextLoaderListener.class)
             //.requestListenerClass(ServletRequestListener.class)
             .build());

}

@Override
    protected TestContainerFactory getTestContainerFactory() {
GrizzlyWebTestContainerFactory webFactory =
        new GrizzlyWebTestContainerFactory();

return webFactory;
    }



    @Test
    public void should_return_lineup_index_data(){
   
    WebResource webResource = resource();
    /* Response responseMsg = webResource.path("/lineup/index")
    .queryParam("lineupId", "908")
        .queryParam("culture", "en-US")
    .get(Response.class);*/
    String responseMsg = webResource.path("/lineup/index")
    .queryParam("lineupId", "936")
    .queryParam("culture", "")
    .get(String.class);
   
    System.out.println(responseMsg);
    Assert.assertNotNull(responseMsg);
   
    }
  

}
分享到:
评论

相关推荐

    jersery client调用REST框架web services服务的一个示例

    标题 "jersery client调用REST框架web services服务的一个示例" 描述了一种使用Jersey客户端库来访问RESTful Web服务的技术。REST(Representational State Transfer)是一种网络应用程序的设计风格和开发方式,基于...

    关于jersery

    Jersey 是一个流行的开源框架,用于创建 RESTful Web 服务。它基于 Java 框架,实现了 JAX-RS(Java API for RESTful Web Services)规范,使得开发人员能够轻松地构建高效、灵活的Web服务。Spring 是另一个广泛使用...

    jersery RestFul web service工程 应用了httpClient demo以及日志操作源码和java 动态反射机制

    jersery RestFull web service工程 应用了httpClient demo以及日志操作源码和java 动态反射机制 整个工程用来对外提供一个简化的ceph云存储服务器的restful api 同时工程作为 学习jersery 以及简单的统一日志管理 ...

    tutorial spring jersey

    【教程:Spring与Jersey构建REST服务】 REST(Representational State Transfer)已成为构建Web服务的默认标准,因为它们易于构建且易于消费。REST在微服务世界中的地位有更深入的讨论,但在这个教程中,我们将专注...

    jersey+spring

    《jersey+spring整合应用详解》 在现代Web开发中,jersey和spring的结合使用已经成为构建RESTful API服务的常见选择。jersey是Java语言中实现 Representational State Transfer (REST) 架构风格的轻量级框架,而...

    jersey-guava-2.17.jar

    java运行依赖jar包

    构建 jersey+restful 所需JAR包

    【标题】:“构建 Jersey+RESTful 所需 JAR 包” 在开发基于Java的RESTful Web服务时,Jersey是一个常用的实现框架。...而Jersey是Java语言中实现JAX-RS(Java API for RESTful Web Services)规范的开源项目,它提供...

    Struts2返回JSON对象的方法总结完整实例

    如果是作为客户端的HTTP+JSON接口工程,没有JSP等view视图的情况下,使用Jersery框架开发绝对是第一选择。而在基于Spring3 MVC的架构下,对HTTP+JSON的返回类型也有很好的支持。但是,在开发工作中,对功能的升级是...

    schema-registry

    它使用jersery-1.9与hadoop-2.6兼容。 它使用mysql作为元存储库。 如何建造 $ mvn clean package assembly:single $ ls -l repo/target/schema-registry-repo-{version}-distro.tar.gz 如何安装 解压disto tar,...

    spring4.x + jersey2.x +restful

    在IT行业中,构建高效、可扩展的Web服务是至关重要的,而RESTful API设计原则已经成为了现代Web服务的标准。本文将深入探讨如何结合Spring 4.x框架与Jersey 2.x库来实现RESTful风格的接口服务,并详细介绍相关依赖及...

    spring4.x 集成 jersey2.x 实现对外提供接口服务

    在本文中,我们将深入探讨如何将Spring 4.x框架与Jersey 2.x结合,以构建一个能够对外提供RESTful接口服务的系统。这个过程包括了配置、组件整合以及实际的API开发。以下是对整个集成过程的详细说明。...

    Java调rest接口依赖包

    在Java开发中,REST(Representational State Transfer)接口已经成为一种广泛应用的Web服务交互方式,它以简洁、轻量级的特点,使得服务提供者和消费者之间的通信变得高效且易于理解。当我们需要在Java后台调用...

    基于jersey v2.10的webservice核心框架

    **基于Jersey v2.10的Web服务核心框架** Jersey是Java世界中实现RESTful Web服务的主要库,它基于JSR 311和JSR 339(JAX-RS)标准。在Jersey v2.10版本中,开发者可以构建高度可扩展和模块化的RESTful服务。...

    jersey-client-1.18.1.jar

    jersey-client-1.18.1 jersey-client 跨服务器文件上传 如果不能免费下载,关注我,评论区联系我索要!

Global site tag (gtag.js) - Google Analytics