Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify integration test configuration

  • Loading branch information...
commit 049f7f9dea49ae68e6890f7768938a53cc27cd10 1 parent ecdc6ee
@dsyer dsyer authored
View
14 README.md
@@ -5,7 +5,10 @@ Security programming models and configuration idioms.
# Getting Started
-Clone from GIT and then use Maven (2.2.*):
+[Dowload](https://github.com/SpringSource/spring-security-oauth/tags)
+or clone from
+[GIT](https://github.com/SpringSource/spring-security-oauth) and then
+use Maven (2.2.*):
$ git clone ...
$ mvn install -P bootstrap
@@ -23,6 +26,15 @@ Software License Version 2.0 (see license.txt).
Samples and integration tests are in [a subdirectory](./samples).
There is a separate README there for orientation and information.
+Once you have installed the artifacts locally (as per the getting
+started instructions above) you should be able to
+
+ $ cd samples/oauth2/tonr
+ $ mvn tomcat:run
+
+and visit the app in your browser at [http://localhost:8080/tonr/][]
+to check that it works. (This is for the OAuth 2.0 sample, for the
+OAuth 1.0a sample just remove the "2" from the directory path.)
## Changelog
View
7 pom.xml
@@ -103,7 +103,7 @@
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
- <exclude>cargo-installs,target/tomcat5x,target/war</exclude>
+ <exclude>target/tomcat,target/war</exclude>
</configuration>
</plugin>
<plugin>
@@ -151,11 +151,6 @@
</plugins>
<pluginManagement>
<plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.25</version>
- </plugin>
<plugin>
<!-- configures the springsource bundlor plugin, which generates OSGI-compatible MANIFEST.MF files during the 'compile'
phase of the maven build. this plugin is declared within the pluginManagement section because not every module that inherits
View
12 samples/oauth/sparklr/pom.xml
@@ -18,18 +18,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
- <configuration>
- <warSourceDirectory>src/main/webapp</warSourceDirectory>
- <webResources>
- <resource>
- <directory>src/main/webapp</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- </includes>
- </resource>
- </webResources>
- </configuration>
</plugin>
<plugin>
<!--skip deploy (this is just a test module) -->
View
73 samples/oauth2/sparklr/pom.xml
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -20,26 +21,20 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
- <configuration>
- <warSourceDirectory>src/main/webapp</warSourceDirectory>
- <webResources>
- <resource>
- <directory>src/main/webapp</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- </includes>
- </resource>
- </webResources>
- </configuration>
- </plugin>
- <plugin>
- <!-- skip unit test run, tests to be executed during integration-test -->
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.9</version>
+ <version>2.7.1</version>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>${skipTests}</skip>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
<!--skip deploy (this is just a test module) -->
@@ -49,6 +44,23 @@
<skip>true</skip>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>start-tomcat</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <fork>true</fork>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -60,6 +72,27 @@
<addContextWarDependencies>true</addContextWarDependencies>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id></id>
+ <phase>install</phase>
+ <goals>
+ <goal>install-file</goal>
+ </goals>
+ <inherited>false</inherited>
+ <configuration>
+ <file>target/${pom.artifactId}-${pom.version}.war</file>
+ <groupId>${pom.groupId}.test</groupId>
+ <artifactId>sparklr</artifactId>
+ <version>${pom.version}</version>
+ <packaging>war</packaging>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</pluginManagement>
</build>
View
14 samples/oauth2/sparklr/src/main/webapp/WEB-INF/web.xml
@@ -15,20 +15,6 @@
</init-param>
</filter>
- <filter>
- <filter-name>oauth2EndpointUrlFilter</filter-name>
- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
- <init-param>
- <param-name>contextAttribute</param-name>
- <param-value>org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring</param-value>
- </init-param>
- </filter>
-
- <filter-mapping>
- <filter-name>oauth2EndpointUrlFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
View
45 samples/oauth2/tonr/pom.xml
@@ -19,6 +19,23 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.1</version>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>${skipTests}</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<!--skip deploy (this is just a test module) -->
<artifactId>maven-deploy-plugin</artifactId>
<version>2.6</version>
@@ -26,6 +43,23 @@
<skip>true</skip>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>start-tomcat</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <fork>true</fork>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -57,8 +91,8 @@
<dependencies>
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>sparklr2</artifactId>
+ <groupId>${pom.groupId}.test</groupId>
+ <artifactId>sparklr</artifactId>
<version>${pom.version}</version>
<type>war</type>
<scope>tomcat</scope>
@@ -114,13 +148,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- <scope>test</scope>
- </dependency>
-
</dependencies>
</project>
View
16 samples/oauth2/tonr/src/test/java/org/springframework/security/oauth/examples/tonr/ServerRunning.java
@@ -9,8 +9,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assume;
@@ -26,7 +24,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpResponse;
-import org.springframework.http.client.CommonsClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RequestCallback;
@@ -255,15 +253,13 @@ public HttpStatus getStatusCode(String path) {
public RestTemplate getRestTemplate() {
RestTemplate client = new RestTemplate();
- CommonsClientHttpRequestFactory requestFactory = new CommonsClientHttpRequestFactory() {
+ client.setRequestFactory(new SimpleClientHttpRequestFactory() {
@Override
- protected void postProcessCommonsHttpMethod(HttpMethodBase httpMethod) {
- httpMethod.setFollowRedirects(false);
- // We don't want stateful conversations for this test
- httpMethod.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
+ protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
+ super.prepareConnection(connection, httpMethod);
+ connection.setInstanceFollowRedirects(false);
}
- };
- client.setRequestFactory(requestFactory);
+ });
client.setErrorHandler(new ResponseErrorHandler() {
// Pass errors through in response entity for status code analysis
public boolean hasError(ClientHttpResponse response) throws IOException {
Please sign in to comment.
Something went wrong with that request. Please try again.