timeout work
This commit is contained in:
		
							parent
							
								
									7d17c4dd9d
								
							
						
					
					
						commit
						a830caca39
					
				@ -1,275 +1,294 @@
 | 
				
			|||||||
<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/xsd/maven-4.0.0.xsd">
 | 
					<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
				
			||||||
    <modelVersion>4.0.0</modelVersion>
 | 
						xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
				
			||||||
    <groupId>org.baeldung</groupId>
 | 
						<modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
    <artifactId>spring-security-rest-template</artifactId>
 | 
						<groupId>org.baeldung</groupId>
 | 
				
			||||||
    <version>0.1-SNAPSHOT</version>
 | 
						<artifactId>spring-security-rest-template</artifactId>
 | 
				
			||||||
 | 
						<version>0.1-SNAPSHOT</version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <name>spring-security-rest-template</name>
 | 
						<name>spring-security-rest-template</name>
 | 
				
			||||||
    <packaging>war</packaging>
 | 
						<packaging>war</packaging>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <dependencies>
 | 
						<dependencies>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- Spring Security -->
 | 
							<!-- Spring Security -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.springframework.security</groupId>
 | 
								<groupId>org.springframework.security</groupId>
 | 
				
			||||||
            <artifactId>spring-security-web</artifactId>
 | 
								<artifactId>spring-security-web</artifactId>
 | 
				
			||||||
            <version>${org.springframework.security.version}</version>
 | 
								<version>${org.springframework.security.version}</version>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.springframework.security</groupId>
 | 
								<groupId>org.springframework.security</groupId>
 | 
				
			||||||
            <artifactId>spring-security-config</artifactId>
 | 
								<artifactId>spring-security-config</artifactId>
 | 
				
			||||||
            <version>${org.springframework.security.version}</version>
 | 
								<version>${org.springframework.security.version}</version>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- Spring -->
 | 
							<!-- Spring -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <artifactId>spring-core</artifactId>
 | 
								<artifactId>spring-core</artifactId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        </dependency>
 | 
								<exclusions>
 | 
				
			||||||
        <dependency>
 | 
									<exclusion>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
										<artifactId>commons-logging</artifactId>
 | 
				
			||||||
            <artifactId>spring-context</artifactId>
 | 
										<groupId>commons-logging</groupId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
									</exclusion>
 | 
				
			||||||
        </dependency>
 | 
								</exclusions>
 | 
				
			||||||
        <dependency>
 | 
							</dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
							<dependency>
 | 
				
			||||||
            <artifactId>spring-jdbc</artifactId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<artifactId>spring-context</artifactId>
 | 
				
			||||||
        </dependency>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        <dependency>
 | 
							</dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
							<dependency>
 | 
				
			||||||
            <artifactId>spring-beans</artifactId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<artifactId>spring-jdbc</artifactId>
 | 
				
			||||||
        </dependency>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        <dependency>
 | 
							</dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
							<dependency>
 | 
				
			||||||
            <artifactId>spring-aop</artifactId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<artifactId>spring-beans</artifactId>
 | 
				
			||||||
        </dependency>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        <dependency>
 | 
							</dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
							<dependency>
 | 
				
			||||||
            <artifactId>spring-tx</artifactId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<artifactId>spring-aop</artifactId>
 | 
				
			||||||
        </dependency>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        <dependency>
 | 
							</dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
							<dependency>
 | 
				
			||||||
            <artifactId>spring-expression</artifactId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<artifactId>spring-tx</artifactId>
 | 
				
			||||||
        </dependency>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
 | 
							<dependency>
 | 
				
			||||||
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
 | 
								<artifactId>spring-expression</artifactId>
 | 
				
			||||||
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <artifactId>spring-web</artifactId>
 | 
								<artifactId>spring-web</artifactId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <artifactId>spring-webmvc</artifactId>
 | 
								<artifactId>spring-webmvc</artifactId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <artifactId>spring-oxm</artifactId>
 | 
								<artifactId>spring-oxm</artifactId>
 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- marshalling -->
 | 
							<!-- marshalling -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>com.fasterxml.jackson.core</groupId>
 | 
								<groupId>com.fasterxml.jackson.core</groupId>
 | 
				
			||||||
            <artifactId>jackson-databind</artifactId>
 | 
								<artifactId>jackson-databind</artifactId>
 | 
				
			||||||
            <version>2.2.2</version>
 | 
								<version>2.2.2</version>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- http -->
 | 
							<!-- http -->
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
        <dependency>
 | 
					<!-- 		<dependency> -->
 | 
				
			||||||
            <groupId>org.apache.httpcomponents</groupId>
 | 
					<!-- 			<groupId>org.apache.httpcomponents</groupId> -->
 | 
				
			||||||
            <artifactId>httpcore</artifactId>
 | 
					<!-- 			<artifactId>fluent-hc</artifactId> -->
 | 
				
			||||||
            <version>${httpcore.version}</version>
 | 
					<!-- 			<version>4.2.5</version> -->
 | 
				
			||||||
            <exclusions>
 | 
					<!-- 			<exclusions> -->
 | 
				
			||||||
                <exclusion>
 | 
					<!-- 				<exclusion> -->
 | 
				
			||||||
                    <artifactId>commons-logging</artifactId>
 | 
					<!-- 					<artifactId>commons-logging</artifactId> -->
 | 
				
			||||||
                    <groupId>commons-logging</groupId>
 | 
					<!-- 					<groupId>commons-logging</groupId> -->
 | 
				
			||||||
                </exclusion>
 | 
					<!-- 				</exclusion> -->
 | 
				
			||||||
            </exclusions>
 | 
					<!-- 			</exclusions> -->
 | 
				
			||||||
        </dependency>
 | 
					<!-- 		</dependency> -->
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.apache.httpcomponents</groupId>
 | 
								<groupId>org.apache.httpcomponents</groupId>
 | 
				
			||||||
            <artifactId>httpclient</artifactId>
 | 
								<artifactId>httpcore</artifactId>
 | 
				
			||||||
            <version>${httpclient.version}</version>
 | 
								<version>${httpcore.version}</version>
 | 
				
			||||||
            <exclusions>
 | 
								<exclusions>
 | 
				
			||||||
                <exclusion>
 | 
									<exclusion>
 | 
				
			||||||
                    <artifactId>commons-logging</artifactId>
 | 
										<artifactId>commons-logging</artifactId>
 | 
				
			||||||
                    <groupId>commons-logging</groupId>
 | 
										<groupId>commons-logging</groupId>
 | 
				
			||||||
                </exclusion>
 | 
									</exclusion>
 | 
				
			||||||
            </exclusions>
 | 
								</exclusions>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- web -->
 | 
							<dependency>
 | 
				
			||||||
 | 
								<groupId>org.apache.httpcomponents</groupId>
 | 
				
			||||||
 | 
								<artifactId>httpclient</artifactId>
 | 
				
			||||||
 | 
								<version>${httpclient.version}</version>
 | 
				
			||||||
 | 
								<exclusions>
 | 
				
			||||||
 | 
									<exclusion>
 | 
				
			||||||
 | 
										<artifactId>commons-logging</artifactId>
 | 
				
			||||||
 | 
										<groupId>commons-logging</groupId>
 | 
				
			||||||
 | 
									</exclusion>
 | 
				
			||||||
 | 
								</exclusions>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<!-- web -->
 | 
				
			||||||
            <groupId>javax.servlet</groupId>
 | 
					 | 
				
			||||||
            <artifactId>javax.servlet-api</artifactId>
 | 
					 | 
				
			||||||
            <version>3.0.1</version>
 | 
					 | 
				
			||||||
            <scope>provided</scope>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>javax.servlet</groupId>
 | 
								<groupId>javax.servlet</groupId>
 | 
				
			||||||
            <artifactId>jstl</artifactId>
 | 
								<artifactId>javax.servlet-api</artifactId>
 | 
				
			||||||
            <version>1.2</version>
 | 
								<version>3.0.1</version>
 | 
				
			||||||
            <scope>runtime</scope>
 | 
								<scope>provided</scope>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- util -->
 | 
							<dependency>
 | 
				
			||||||
 | 
								<groupId>javax.servlet</groupId>
 | 
				
			||||||
 | 
								<artifactId>jstl</artifactId>
 | 
				
			||||||
 | 
								<version>1.2</version>
 | 
				
			||||||
 | 
								<scope>runtime</scope>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<!-- util -->
 | 
				
			||||||
            <groupId>com.google.guava</groupId>
 | 
					 | 
				
			||||||
            <artifactId>guava</artifactId>
 | 
					 | 
				
			||||||
            <version>${guava.version}</version>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- test scoped -->
 | 
							<dependency>
 | 
				
			||||||
 | 
								<groupId>com.google.guava</groupId>
 | 
				
			||||||
 | 
								<artifactId>guava</artifactId>
 | 
				
			||||||
 | 
								<version>${guava.version}</version>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<!-- test scoped -->
 | 
				
			||||||
            <groupId>org.springframework</groupId>
 | 
					 | 
				
			||||||
            <artifactId>spring-test</artifactId>
 | 
					 | 
				
			||||||
            <version>${org.springframework.version}</version>
 | 
					 | 
				
			||||||
            <scope>test</scope>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>junit</groupId>
 | 
								<groupId>org.springframework</groupId>
 | 
				
			||||||
            <artifactId>junit-dep</artifactId>
 | 
								<artifactId>spring-test</artifactId>
 | 
				
			||||||
            <version>${junit.version}</version>
 | 
								<version>${org.springframework.version}</version>
 | 
				
			||||||
            <scope>test</scope>
 | 
								<scope>test</scope>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.hamcrest</groupId>
 | 
								<groupId>junit</groupId>
 | 
				
			||||||
            <artifactId>hamcrest-core</artifactId>
 | 
								<artifactId>junit-dep</artifactId>
 | 
				
			||||||
            <version>${org.hamcrest.version}</version>
 | 
								<version>${junit.version}</version>
 | 
				
			||||||
            <scope>test</scope>
 | 
								<scope>test</scope>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
        <dependency>
 | 
					 | 
				
			||||||
            <groupId>org.hamcrest</groupId>
 | 
					 | 
				
			||||||
            <artifactId>hamcrest-library</artifactId>
 | 
					 | 
				
			||||||
            <version>${org.hamcrest.version}</version>
 | 
					 | 
				
			||||||
            <scope>test</scope>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <dependency>
 | 
							<dependency>
 | 
				
			||||||
            <groupId>org.mockito</groupId>
 | 
								<groupId>org.hamcrest</groupId>
 | 
				
			||||||
            <artifactId>mockito-core</artifactId>
 | 
								<artifactId>hamcrest-core</artifactId>
 | 
				
			||||||
            <version>${mockito.version}</version>
 | 
								<version>${org.hamcrest.version}</version>
 | 
				
			||||||
            <scope>test</scope>
 | 
								<scope>test</scope>
 | 
				
			||||||
        </dependency>
 | 
							</dependency>
 | 
				
			||||||
 | 
							<dependency>
 | 
				
			||||||
 | 
								<groupId>org.hamcrest</groupId>
 | 
				
			||||||
 | 
								<artifactId>hamcrest-library</artifactId>
 | 
				
			||||||
 | 
								<version>${org.hamcrest.version}</version>
 | 
				
			||||||
 | 
								<scope>test</scope>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </dependencies>
 | 
							<dependency>
 | 
				
			||||||
 | 
								<groupId>org.mockito</groupId>
 | 
				
			||||||
 | 
								<artifactId>mockito-core</artifactId>
 | 
				
			||||||
 | 
								<version>${mockito.version}</version>
 | 
				
			||||||
 | 
								<scope>test</scope>
 | 
				
			||||||
 | 
							</dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <build>
 | 
						</dependencies>
 | 
				
			||||||
        <finalName>spring-security-rest-template</finalName>
 | 
					 | 
				
			||||||
        <resources>
 | 
					 | 
				
			||||||
            <resource>
 | 
					 | 
				
			||||||
                <directory>src/main/resources</directory>
 | 
					 | 
				
			||||||
                <filtering>true</filtering>
 | 
					 | 
				
			||||||
            </resource>
 | 
					 | 
				
			||||||
        </resources>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <plugins>
 | 
						<build>
 | 
				
			||||||
 | 
							<finalName>spring-security-rest-template</finalName>
 | 
				
			||||||
 | 
							<resources>
 | 
				
			||||||
 | 
								<resource>
 | 
				
			||||||
 | 
									<directory>src/main/resources</directory>
 | 
				
			||||||
 | 
									<filtering>true</filtering>
 | 
				
			||||||
 | 
								</resource>
 | 
				
			||||||
 | 
							</resources>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <plugin>
 | 
							<plugins>
 | 
				
			||||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
					 | 
				
			||||||
                <artifactId>maven-compiler-plugin</artifactId>
 | 
					 | 
				
			||||||
                <version>3.1</version>
 | 
					 | 
				
			||||||
                <configuration>
 | 
					 | 
				
			||||||
                    <source>1.7</source>
 | 
					 | 
				
			||||||
                    <target>1.7</target>
 | 
					 | 
				
			||||||
                    <debug>true</debug>
 | 
					 | 
				
			||||||
                    <debuglevel>source</debuglevel>
 | 
					 | 
				
			||||||
                </configuration>
 | 
					 | 
				
			||||||
            </plugin>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <plugin>
 | 
								<plugin>
 | 
				
			||||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
									<groupId>org.apache.maven.plugins</groupId>
 | 
				
			||||||
                <artifactId>maven-surefire-plugin</artifactId>
 | 
									<artifactId>maven-compiler-plugin</artifactId>
 | 
				
			||||||
                <version>${maven-surefire-plugin.version}</version>
 | 
									<version>3.1</version>
 | 
				
			||||||
                <configuration>
 | 
									<configuration>
 | 
				
			||||||
                    <excludes>
 | 
										<source>1.7</source>
 | 
				
			||||||
                        <exclude>**/*LiveTest.java</exclude>
 | 
										<target>1.7</target>
 | 
				
			||||||
                    </excludes>
 | 
										<debug>true</debug>
 | 
				
			||||||
                    <systemPropertyVariables>
 | 
										<debuglevel>source</debuglevel>
 | 
				
			||||||
                        <!-- <provPersistenceTarget>h2</provPersistenceTarget> -->
 | 
									</configuration>
 | 
				
			||||||
                    </systemPropertyVariables>
 | 
								</plugin>
 | 
				
			||||||
                </configuration>
 | 
					 | 
				
			||||||
            </plugin>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <plugin>
 | 
								<plugin>
 | 
				
			||||||
                <groupId>org.codehaus.cargo</groupId>
 | 
									<groupId>org.apache.maven.plugins</groupId>
 | 
				
			||||||
                <artifactId>cargo-maven2-plugin</artifactId>
 | 
									<artifactId>maven-surefire-plugin</artifactId>
 | 
				
			||||||
                <version>${cargo-maven2-plugin.version}</version>
 | 
									<version>${maven-surefire-plugin.version}</version>
 | 
				
			||||||
                <configuration>
 | 
									<configuration>
 | 
				
			||||||
                    <wait>true</wait>
 | 
										<excludes>
 | 
				
			||||||
                    <container>
 | 
											<exclude>**/*LiveTest.java</exclude>
 | 
				
			||||||
                        <containerId>jetty8x</containerId>
 | 
										</excludes>
 | 
				
			||||||
                        <type>embedded</type>
 | 
										<systemPropertyVariables>
 | 
				
			||||||
                        <systemProperties>
 | 
											<!-- <provPersistenceTarget>h2</provPersistenceTarget> -->
 | 
				
			||||||
                            <!-- <provPersistenceTarget>cargo</provPersistenceTarget> -->
 | 
										</systemPropertyVariables>
 | 
				
			||||||
                        </systemProperties>
 | 
									</configuration>
 | 
				
			||||||
                    </container>
 | 
								</plugin>
 | 
				
			||||||
                    <configuration>
 | 
					 | 
				
			||||||
                        <properties>
 | 
					 | 
				
			||||||
                            <cargo.servlet.port>8082</cargo.servlet.port>
 | 
					 | 
				
			||||||
                        </properties>
 | 
					 | 
				
			||||||
                    </configuration>
 | 
					 | 
				
			||||||
                </configuration>
 | 
					 | 
				
			||||||
            </plugin>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        </plugins>
 | 
								<plugin>
 | 
				
			||||||
 | 
									<groupId>org.codehaus.cargo</groupId>
 | 
				
			||||||
 | 
									<artifactId>cargo-maven2-plugin</artifactId>
 | 
				
			||||||
 | 
									<version>${cargo-maven2-plugin.version}</version>
 | 
				
			||||||
 | 
									<configuration>
 | 
				
			||||||
 | 
										<wait>true</wait>
 | 
				
			||||||
 | 
										<container>
 | 
				
			||||||
 | 
											<containerId>jetty8x</containerId>
 | 
				
			||||||
 | 
											<type>embedded</type>
 | 
				
			||||||
 | 
											<systemProperties>
 | 
				
			||||||
 | 
												<!-- <provPersistenceTarget>cargo</provPersistenceTarget> -->
 | 
				
			||||||
 | 
											</systemProperties>
 | 
				
			||||||
 | 
										</container>
 | 
				
			||||||
 | 
										<configuration>
 | 
				
			||||||
 | 
											<properties>
 | 
				
			||||||
 | 
												<cargo.servlet.port>8082</cargo.servlet.port>
 | 
				
			||||||
 | 
											</properties>
 | 
				
			||||||
 | 
										</configuration>
 | 
				
			||||||
 | 
									</configuration>
 | 
				
			||||||
 | 
								</plugin>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </build>
 | 
							</plugins>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <properties>
 | 
						</build>
 | 
				
			||||||
        <!-- Spring -->
 | 
					 | 
				
			||||||
        <org.springframework.version>3.2.3.RELEASE</org.springframework.version>
 | 
					 | 
				
			||||||
        <org.springframework.security.version>3.1.4.RELEASE</org.springframework.security.version>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- persistence -->
 | 
						<properties>
 | 
				
			||||||
        <hibernate.version>4.2.3.Final</hibernate.version>
 | 
							<!-- Spring -->
 | 
				
			||||||
        <mysql-connector-java.version>5.1.25</mysql-connector-java.version>
 | 
							<org.springframework.version>3.2.3.RELEASE</org.springframework.version>
 | 
				
			||||||
 | 
							<org.springframework.security.version>3.1.4.RELEASE</org.springframework.security.version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- http -->
 | 
							<!-- persistence -->
 | 
				
			||||||
        <httpcore.version>4.2.4</httpcore.version>
 | 
							<hibernate.version>4.2.3.Final</hibernate.version>
 | 
				
			||||||
        <httpclient.version>4.2.5</httpclient.version>
 | 
							<mysql-connector-java.version>5.1.25</mysql-connector-java.version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- logging -->
 | 
							<!-- http -->
 | 
				
			||||||
        <org.slf4j.version>1.7.5</org.slf4j.version>
 | 
							<httpcore.version>4.2.4</httpcore.version>
 | 
				
			||||||
        <logback.version>1.0.11</logback.version>
 | 
							<httpclient.version>4.2.5</httpclient.version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- various -->
 | 
							<!-- logging -->
 | 
				
			||||||
        <hibernate-validator.version>5.0.1.Final</hibernate-validator.version>
 | 
							<org.slf4j.version>1.7.5</org.slf4j.version>
 | 
				
			||||||
 | 
							<logback.version>1.0.11</logback.version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- util -->
 | 
							<!-- various -->
 | 
				
			||||||
        <guava.version>14.0.1</guava.version>
 | 
							<hibernate-validator.version>5.0.1.Final</hibernate-validator.version>
 | 
				
			||||||
        <commons-lang3.version>3.1</commons-lang3.version>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- testing -->
 | 
							<!-- util -->
 | 
				
			||||||
        <org.hamcrest.version>1.3</org.hamcrest.version>
 | 
							<guava.version>14.0.1</guava.version>
 | 
				
			||||||
        <junit.version>4.11</junit.version>
 | 
							<commons-lang3.version>3.1</commons-lang3.version>
 | 
				
			||||||
        <mockito.version>1.9.5</mockito.version>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <rest-assured.version>1.8.1</rest-assured.version>
 | 
							<!-- testing -->
 | 
				
			||||||
        <groovy.version>1.8.9</groovy.version>
 | 
							<org.hamcrest.version>1.3</org.hamcrest.version>
 | 
				
			||||||
 | 
							<junit.version>4.11</junit.version>
 | 
				
			||||||
 | 
							<mockito.version>1.9.5</mockito.version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- Maven plugins -->
 | 
							<rest-assured.version>1.8.1</rest-assured.version>
 | 
				
			||||||
        <cargo-maven2-plugin.version>1.4.3</cargo-maven2-plugin.version>
 | 
							<groovy.version>1.8.9</groovy.version>
 | 
				
			||||||
        <maven-surefire-plugin.version>2.15</maven-surefire-plugin.version>
 | 
					
 | 
				
			||||||
    </properties>
 | 
							<!-- Maven plugins -->
 | 
				
			||||||
 | 
							<cargo-maven2-plugin.version>1.4.3</cargo-maven2-plugin.version>
 | 
				
			||||||
 | 
							<maven-surefire-plugin.version>2.15</maven-surefire-plugin.version>
 | 
				
			||||||
 | 
						</properties>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
@ -30,4 +30,10 @@ public class FooController {
 | 
				
			|||||||
        return new Foo();
 | 
					        return new Foo();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RequestMapping(value = "/{id}/unsecured", method = RequestMethod.GET)
 | 
				
			||||||
 | 
					    @ResponseBody
 | 
				
			||||||
 | 
					    public Foo findOneUnsecured(@PathVariable("id") final Long id) {
 | 
				
			||||||
 | 
					        return new Foo();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,8 @@
 | 
				
			|||||||
		</encoder>
 | 
							</encoder>
 | 
				
			||||||
	</appender>
 | 
						</appender>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						<logger name="org.apache.http" level="TRACE" />
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	<logger name="org.springframework" level="WARN" />
 | 
						<logger name="org.springframework" level="WARN" />
 | 
				
			||||||
	<logger name="org.springframework.transaction" level="WARN" />
 | 
						<logger name="org.springframework.transaction" level="WARN" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,38 +3,43 @@ package org.baeldung.client;
 | 
				
			|||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.apache.http.HttpResponse;
 | 
					import org.apache.http.HttpResponse;
 | 
				
			||||||
import org.apache.http.auth.AuthScope;
 | 
					 | 
				
			||||||
import org.apache.http.auth.UsernamePasswordCredentials;
 | 
					 | 
				
			||||||
import org.apache.http.client.ClientProtocolException;
 | 
					import org.apache.http.client.ClientProtocolException;
 | 
				
			||||||
import org.apache.http.client.methods.HttpGet;
 | 
					import org.apache.http.client.methods.HttpGet;
 | 
				
			||||||
import org.apache.http.impl.client.DefaultHttpClient;
 | 
					import org.apache.http.impl.client.DefaultHttpClient;
 | 
				
			||||||
 | 
					import org.apache.http.params.HttpConnectionParams;
 | 
				
			||||||
 | 
					import org.apache.http.params.HttpParams;
 | 
				
			||||||
import org.baeldung.client.spring.ClientConfig;
 | 
					import org.baeldung.client.spring.ClientConfig;
 | 
				
			||||||
import org.junit.Test;
 | 
					import org.junit.Test;
 | 
				
			||||||
import org.junit.runner.RunWith;
 | 
					import org.junit.runner.RunWith;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					 | 
				
			||||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 | 
					 | 
				
			||||||
import org.springframework.test.context.ContextConfiguration;
 | 
					import org.springframework.test.context.ContextConfiguration;
 | 
				
			||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 | 
					import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 | 
				
			||||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
 | 
					import org.springframework.test.context.support.AnnotationConfigContextLoader;
 | 
				
			||||||
import org.springframework.web.client.RestTemplate;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@RunWith(SpringJUnit4ClassRunner.class)
 | 
					@RunWith(SpringJUnit4ClassRunner.class)
 | 
				
			||||||
@ContextConfiguration(classes = { ClientConfig.class }, loader = AnnotationConfigContextLoader.class)
 | 
					@ContextConfiguration(classes = { ClientConfig.class }, loader = AnnotationConfigContextLoader.class)
 | 
				
			||||||
public class RawClientLiveTest {
 | 
					public class RawClientLiveTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private RestTemplate restTemplate;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // tests
 | 
					    // tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    public final void whenSecuredRestApiIsConsumed_then200OK() throws ClientProtocolException, IOException {
 | 
					    public final void whenSecuredRestApiIsConsumed_then200OK() throws ClientProtocolException, IOException {
 | 
				
			||||||
        final HttpComponentsClientHttpRequestFactory requestFactory = (HttpComponentsClientHttpRequestFactory) restTemplate.getRequestFactory();
 | 
					        final DefaultHttpClient httpClient = new DefaultHttpClient();
 | 
				
			||||||
        final DefaultHttpClient httpClient = (DefaultHttpClient) requestFactory.getHttpClient();
 | 
					 | 
				
			||||||
        httpClient.getCredentialsProvider().setCredentials(new AuthScope("localhost", 8080, AuthScope.ANY_REALM), new UsernamePasswordCredentials("user", "userPass"));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        final HttpResponse response = httpClient.execute(new HttpGet("http://localhost:8080/spring-security-rest-template/api/foos/1"));
 | 
					        final int timeout = 5; // seconds
 | 
				
			||||||
 | 
					        final HttpParams httpParams = httpClient.getParams();
 | 
				
			||||||
 | 
					        // - note: timeout via raw String parameters
 | 
				
			||||||
 | 
					        // httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout * 1000);
 | 
				
			||||||
 | 
					        // httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, timeout * 1000);
 | 
				
			||||||
 | 
					        // httpParams.setParameter("http.connection-manager.timeout", new Long(timeout * 1000));
 | 
				
			||||||
 | 
					        // httpParams.setParameter("http.protocol.head-body-timeout", timeout * 1000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // - note: timeout via the API
 | 
				
			||||||
 | 
					        HttpConnectionParams.setConnectionTimeout(httpParams, timeout * 1000); // http.connection.timeout
 | 
				
			||||||
 | 
					        HttpConnectionParams.setSoTimeout(httpParams, timeout * 1000); // http.socket.timeout
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        final HttpResponse response = httpClient.execute(new HttpGet("http://localhost:8080/spring-security-rest-template/api/foos/1/unsecured"));
 | 
				
			||||||
        final int statusCode = response.getStatusLine().getStatusCode();
 | 
					        final int statusCode = response.getStatusLine().getStatusCode();
 | 
				
			||||||
        System.out.println(statusCode);
 | 
					        System.out.println(statusCode);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user