You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2020/11/23 20:55:52 UTC

[shiro] branch 1.7.x updated: (test) convert EnvironmentLoaderServiceTest partly to integration test.

This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/1.7.x by this push:
     new 41436c8  (test) convert EnvironmentLoaderServiceTest partly to integration test.
     new e35a669  Merge pull request #267 from bmarwell/envloader_it
41436c8 is described below

commit 41436c8c010715162b42020550ea3c435bb8fcc2
Author: Benjamin Marwell <bm...@gmail.com>
AuthorDate: Mon Nov 23 10:28:28 2020 +0100

    (test) convert EnvironmentLoaderServiceTest partly to integration test.
    
     - remove usage of Powermock on Java-internal classes
     - add IT with a secondary ServiceLoadable WebEnvironment, replacing multipleServiceTest
     - add run-its profile to travis and Jenkinsfiles
---
 .gitignore                                         |  2 +
 .travis.yml                                        |  2 +-
 Jenkinsfile                                        |  4 +-
 Jenkinsfile-jdk11                                  |  4 +-
 Jenkinsfile-jdk14                                  |  4 +-
 pom.xml                                            | 73 +++++++++++++++++++++-
 web/src/it/mrm/settings.xml                        | 71 +++++++++++++++++++++
 .../MultipleServiceLoader/invoker.properties       | 27 +-------
 web/src/it/projects/MultipleServiceLoader/pom.xml  | 68 ++++++++++++++++++++
 .../web/it/loader/SecondaryWebEnvironment.java     | 47 ++++++++++++++
 .../org.apache.shiro.web.env.WebEnvironment        | 26 +-------
 .../web/it/loader/SecondaryWebEnvironmentTest.java | 55 ++++++++++++++++
 .../web/env/EnvironmentLoaderServiceTest.java      | 58 +++++------------
 .../shiro/web/env/EnvironmentLoaderServiceTest.ini | 28 +--------
 14 files changed, 346 insertions(+), 123 deletions(-)

diff --git a/.gitignore b/.gitignore
index 42cc59f..dc39926 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,5 @@ target/
 release.properties
 pom.xml.*
 -
+/**/src/it/projects/*/build.log
+/**/src/it/projects/*/target
diff --git a/.travis.yml b/.travis.yml
index 8cbcdb0..96ffae6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,7 @@ install:
 - 'true'
 
 script:
-- "mvn -e -Pci,docs install apache-rat:check -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
+- "mvn -e -Pci,docs,run-its install apache-rat:check -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
 
 after_success:
 - bash <(curl -s https://codecov.io/bash) -f test-coverage/target/site/jacoco-aggregate/jacoco.xml
diff --git a/Jenkinsfile b/Jenkinsfile
index e92a867..8474dd7 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -79,7 +79,7 @@ pipeline {
         stage('Tests') {
             steps {
                 echo 'Running tests'
-                sh 'mvn test'
+                sh 'mvn verify -Prun-its'
             }
             post {
                 always {
@@ -171,4 +171,4 @@ Is back to normal.
         }
     }
 
-}
\ No newline at end of file
+}
diff --git a/Jenkinsfile-jdk11 b/Jenkinsfile-jdk11
index 95af902..a996166 100644
--- a/Jenkinsfile-jdk11
+++ b/Jenkinsfile-jdk11
@@ -79,7 +79,7 @@ pipeline {
         stage('Tests') {
             steps {
                 echo 'Running tests'
-                sh 'mvn test'
+                sh 'mvn verify -Prun-its'
             }
             post {
                 always {
@@ -159,4 +159,4 @@ Is back to normal.
         }
     }
 
-}
\ No newline at end of file
+}
diff --git a/Jenkinsfile-jdk14 b/Jenkinsfile-jdk14
index 74f8094..1f5531c 100644
--- a/Jenkinsfile-jdk14
+++ b/Jenkinsfile-jdk14
@@ -79,7 +79,7 @@ pipeline {
         stage('Tests') {
             steps {
                 echo 'Running tests'
-                sh 'mvn test'
+                sh 'mvn verify -Prun-its'
             }
             post {
                 always {
@@ -159,4 +159,4 @@ Is back to normal.
         }
     }
 
-}
\ No newline at end of file
+}
diff --git a/pom.xml b/pom.xml
index 69a3f2a..92ae988 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,7 +108,7 @@
         <htmlunit.version>2.39.0</htmlunit.version>
 
         <!-- Test 3rd-party dependencies: -->
-        <easymock.version>4.0.2</easymock.version>
+        <easymock.version>4.1</easymock.version>
         <gmaven.version>1.8.0</gmaven.version>
         <groovy.version>2.5.8</groovy.version>
         <junit.version>4.12</junit.version>
@@ -284,6 +284,8 @@
                     <configuration>
                     		<!-- note that this configuration needs to be maintain both in pluginManagement and reporting sections -->
                         <excludes>
+                            <exclude>/**/src/it/projects/*/build.log</exclude>
+                            <exclude>/**/src/it/projects/*/target/**</exclude>
                             <exclude>**/.externalToolBuilders/*</exclude>
                             <exclude>**/infinitest.filters</exclude>
                             <!-- Apparently some test in samples/spring-client generates velocity log - would better to reconfigure to output to target/ -->
@@ -433,7 +435,6 @@
                 <version>3.0.0-M3</version>
                 <configuration>
                     <printSummary>true</printSummary>
-                    <useSystemClassLoader>false</useSystemClassLoader>
                 </configuration>
             </plugin>
             <plugin>
@@ -1274,6 +1275,8 @@
                 <configuration>
                 		<!-- note that this configuration needs to be maintain both in pluginManagement and reporting sections -->
                     <excludes>
+                        <exclude>/**/src/it/projects/*/build.log</exclude>
+                        <exclude>/**/src/it/projects/*/target/**</exclude>
                         <exclude>**/.externalToolBuilders/*</exclude>
                         <exclude>**/infinitest.filters</exclude>
                         <!-- Apparently some test in samples/spring-client generates velocity log - would better to reconfigure to output to target/ -->
@@ -1495,5 +1498,71 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+            <id>run-its</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>mrm-maven-plugin</artifactId>
+                        <version>1.1.0</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>start</goal>
+                                    <goal>stop</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <propertyName>mrm.repository.url</propertyName>
+                            <repositories>
+                                <mockRepo>
+                                    <source>src/it/mrm/repository</source>
+                                </mockRepo>
+                                <proxyRepo/>
+                            </repositories>
+                        </configuration>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-invoker-plugin</artifactId>
+                        <configuration>
+                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+                            <environmentVariables>
+                                <!--
+                                  ! Prevent reading the .mavenrc or maven_pre.bat on Windows
+                                  ! in integration tests.
+                                -->
+                                <MAVEN_SKIP_RC>1</MAVEN_SKIP_RC>
+                            </environmentVariables>
+                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+                            <projectsDirectory>src/it/projects</projectsDirectory>
+                            <pomIncludes>
+                                <pomInclude>*/pom.xml</pomInclude>
+                            </pomIncludes>
+                            <settingsFile>src/it/mrm/settings.xml</settingsFile>
+                            <filterProperties>
+                                <mrm.repository.url>${mrm.repository.url}</mrm.repository.url>
+                            </filterProperties>
+                            <goals>
+                                <goal>clean</goal>
+                                <goal>package</goal>
+                            </goals>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>integration-test</id>
+                                <goals>
+                                    <goal>install</goal>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 </project>
diff --git a/web/src/it/mrm/settings.xml b/web/src/it/mrm/settings.xml
new file mode 100644
index 0000000..7ee2085
--- /dev/null
+++ b/web/src/it/mrm/settings.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+  <mirrors>
+    <mirror>
+      <id>mrm-maven-plugin</id>
+      <name>Mock Repository Manager</name>
+      <url>@mrm.repository.url@</url>
+      <mirrorOf>*</mirrorOf>
+    </mirror>
+  </mirrors>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <repositories>
+        <repository>
+          <id>snapshots</id>
+          <url>@mrm.repository.url@</url>
+          <releases>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>always</updatePolicy>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>snapshots</id>
+          <url>@mrm.repository.url@</url>
+          <releases>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>always</updatePolicy>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>it-repo</activeProfile>
+  </activeProfiles>
+</settings>
diff --git a/.gitignore b/web/src/it/projects/MultipleServiceLoader/invoker.properties
similarity index 79%
copy from .gitignore
copy to web/src/it/projects/MultipleServiceLoader/invoker.properties
index 42cc59f..e634c1c 100644
--- a/.gitignore
+++ b/web/src/it/projects/MultipleServiceLoader/invoker.properties
@@ -1,3 +1,4 @@
+#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -14,29 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
-# IntelliJ
-*.ipr
-*.iml
-*.iws
-.idea/
-
 #
-# Eclipse metadata.
-#
-.project
-.classpath
-.settings/
 
-#
-# Eclipse and Maven output folders.
-#
-bin/
-target/
-
-#
-# Maven release metadata
-#
-release.properties
-pom.xml.*
--
+invoker.java.version = 1.8+
+invoker.goals = clean verify
diff --git a/web/src/it/projects/MultipleServiceLoader/pom.xml b/web/src/it/projects/MultipleServiceLoader/pom.xml
new file mode 100644
index 0000000..e46cac0
--- /dev/null
+++ b/web/src/it/projects/MultipleServiceLoader/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<!--suppress osmorcNonOsgiMavenDependency -->
+<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 https://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.shiro.integrationtest</groupId>
+    <artifactId>multipleServiceLoader</artifactId>
+    <version>1.0.0</version>
+
+    <name>Apache Shiro :: Web :: IT :: multipleServiceLoader</name>
+    <packaging>jar</packaging>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-web</artifactId>
+            <version>1.7.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
+            <version>5.6.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-library</artifactId>
+            <version>2.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>3.5.13</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/web/src/it/projects/MultipleServiceLoader/src/main/java/org/apache/shiro/web/it/loader/SecondaryWebEnvironment.java b/web/src/it/projects/MultipleServiceLoader/src/main/java/org/apache/shiro/web/it/loader/SecondaryWebEnvironment.java
new file mode 100644
index 0000000..d494f60
--- /dev/null
+++ b/web/src/it/projects/MultipleServiceLoader/src/main/java/org/apache/shiro/web/it/loader/SecondaryWebEnvironment.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.shiro.web.it.loader;
+
+import org.apache.shiro.mgt.SecurityManager;
+import org.apache.shiro.web.env.WebEnvironment;
+import org.apache.shiro.web.filter.mgt.FilterChainResolver;
+import org.apache.shiro.web.mgt.WebSecurityManager;
+
+public class SecondaryWebEnvironment implements WebEnvironment {
+    @Override
+    public FilterChainResolver getFilterChainResolver() {
+        throw new UnsupportedOperationException("not yet implemented: [org.apache.shiro.web.it.loader.SecondaryWebEnvironment::getFilterChainResolver].");
+    }
+
+    @Override
+    public javax.servlet.ServletContext getServletContext() {
+        throw new UnsupportedOperationException("not yet implemented: [org.apache.shiro.web.it.loader.SecondaryWebEnvironment::getServletContext].");
+    }
+
+    @Override
+    public WebSecurityManager getWebSecurityManager() {
+        throw new UnsupportedOperationException("not yet implemented: [org.apache.shiro.web.it.loader.SecondaryWebEnvironment::getWebSecurityManager].");
+    }
+
+    @Override
+    public SecurityManager getSecurityManager() {
+        throw new UnsupportedOperationException("not yet implemented: [org.apache.shiro.web.it.loader.SecondaryWebEnvironment::getSecurityManager].");
+    }
+}
diff --git a/.gitignore b/web/src/it/projects/MultipleServiceLoader/src/main/resources/META-INF/services/org.apache.shiro.web.env.WebEnvironment
similarity index 79%
copy from .gitignore
copy to web/src/it/projects/MultipleServiceLoader/src/main/resources/META-INF/services/org.apache.shiro.web.env.WebEnvironment
index 42cc59f..f4cd50f 100644
--- a/.gitignore
+++ b/web/src/it/projects/MultipleServiceLoader/src/main/resources/META-INF/services/org.apache.shiro.web.env.WebEnvironment
@@ -1,3 +1,4 @@
+#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -14,29 +15,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
-# IntelliJ
-*.ipr
-*.iml
-*.iws
-.idea/
-
 #
-# Eclipse metadata.
-#
-.project
-.classpath
-.settings/
 
-#
-# Eclipse and Maven output folders.
-#
-bin/
-target/
-
-#
-# Maven release metadata
-#
-release.properties
-pom.xml.*
--
+org.apache.shiro.web.it.loader.SecondaryWebEnvironment
diff --git a/web/src/it/projects/MultipleServiceLoader/src/test/java/org/apache/shiro/web/it/loader/SecondaryWebEnvironmentTest.java b/web/src/it/projects/MultipleServiceLoader/src/test/java/org/apache/shiro/web/it/loader/SecondaryWebEnvironmentTest.java
new file mode 100644
index 0000000..fa8927e
--- /dev/null
+++ b/web/src/it/projects/MultipleServiceLoader/src/test/java/org/apache/shiro/web/it/loader/SecondaryWebEnvironmentTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.shiro.web.it.loader;
+
+import org.apache.shiro.config.ConfigurationException;
+import org.apache.shiro.web.env.EnvironmentLoader;
+import org.hamcrest.MatcherAssert;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+
+import static org.hamcrest.Matchers.stringContainsInOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class SecondaryWebEnvironmentTest {
+
+    @Test
+    @DisplayName("Try loading a WebEnvironment while two implementations are available.")
+    public void multipleServiceTest() {
+        InputStream resourceAsStream = getClass()
+                .getResourceAsStream("/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.ini");
+
+        ServletContext servletContext = mock(ServletContext.class);
+        when(servletContext.getResourceAsStream("/WEB-INF/shiro.ini")).then(args -> resourceAsStream);
+
+        try {
+            new EnvironmentLoader().initEnvironment(servletContext);
+            Assertions.fail("Expected ConfigurationException to be thrown");
+        } catch (ConfigurationException e) {
+            MatcherAssert.assertThat(e.getMessage(), stringContainsInOrder("zero or exactly one", "shiroEnvironmentClass"));
+        }
+    }
+
+}
diff --git a/web/src/test/java/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.java b/web/src/test/java/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.java
index 1c1f975..2fbc0a1 100644
--- a/web/src/test/java/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.java
+++ b/web/src/test/java/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.java
@@ -21,85 +21,65 @@ package org.apache.shiro.web.env;
 import org.apache.shiro.config.ConfigurationException;
 import org.easymock.EasyMock;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.easymock.PowerMock;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 import javax.servlet.ServletContext;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ServiceLoader;
+import java.io.InputStream;
 
 import static org.easymock.EasyMock.expect;
-import static org.hamcrest.Matchers.*;
-import static org.hamcrest.MatcherAssert.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.sameInstance;
+import static org.hamcrest.Matchers.stringContainsInOrder;
 
 /**
  * Tests for {@link EnvironmentLoader} that depend on PowerMock the stub out a ServiceLoader.
  */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(EnvironmentLoader.class)
 public class EnvironmentLoaderServiceTest {
 
     @Test()
     public void singleServiceTest() throws Exception {
-
-        List<WebEnvironmentStub> environmentList = Arrays.asList(new WebEnvironmentStub());
+        InputStream resourceAsStream = getClass()
+                .getResourceAsStream("/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.ini");
 
         ServletContext servletContext = EasyMock.mock(ServletContext.class);
         expect(servletContext.getInitParameter("shiroEnvironmentClass")).andReturn(null);
         expect(servletContext.getInitParameter("shiroConfigLocations")).andReturn(null);
-
-        PowerMock.mockStaticPartialStrict(ServiceLoader.class, "load");
-
-        final ServiceLoader serviceLoader = PowerMock.createMock(ServiceLoader.class);
-
-        EasyMock.expect(ServiceLoader.load(WebEnvironment.class)).andReturn(serviceLoader);
-        EasyMock.expect(serviceLoader.iterator()).andReturn(environmentList.iterator());
+        expect(servletContext.getResourceAsStream("/WEB-INF/shiro.ini")).andReturn(resourceAsStream);
 
         EasyMock.replay(servletContext);
-        PowerMock.replayAll();
 
         WebEnvironment resultEnvironment = new EnvironmentLoader().createEnvironment(servletContext);
 
-        PowerMock.verifyAll();
         EasyMock.verify(servletContext);
 
-        assertThat(resultEnvironment, instanceOf(WebEnvironmentStub.class));
-        WebEnvironmentStub environmentStub = (WebEnvironmentStub) resultEnvironment;
+        assertThat(resultEnvironment, instanceOf(IniWebEnvironment.class));
+        IniWebEnvironment environmentStub = (IniWebEnvironment) resultEnvironment;
 
         assertThat(environmentStub.getServletContext(), sameInstance(servletContext));
     }
 
     @Test()
+    @Ignore
     public void multipleServiceTest() throws Exception {
-
-        List<WebEnvironmentStub> environmentList = Arrays.asList(new WebEnvironmentStub(), new WebEnvironmentStub());
+        InputStream resourceAsStream = getClass()
+                .getResourceAsStream("/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.ini");
 
         ServletContext servletContext = EasyMock.mock(ServletContext.class);
         expect(servletContext.getInitParameter("shiroEnvironmentClass")).andReturn(null);
-
-        PowerMock.mockStaticPartialStrict(ServiceLoader.class, "load");
-
-        final ServiceLoader serviceLoader = PowerMock.createMock(ServiceLoader.class);
-
-        EasyMock.expect(ServiceLoader.load(WebEnvironment.class)).andReturn(serviceLoader);
-        EasyMock.expect(serviceLoader.iterator()).andReturn(environmentList.iterator());
+        expect(servletContext.getInitParameter("shiroConfigLocations")).andReturn(null);
+        expect(servletContext.getResourceAsStream("/WEB-INF/shiro.ini")).andReturn(resourceAsStream);
 
         EasyMock.replay(servletContext);
-        PowerMock.replayAll();
 
         try {
             new EnvironmentLoader().createEnvironment(servletContext);
             Assert.fail("Expected ConfigurationException to be thrown");
-        }
-        catch (ConfigurationException e) {
+        } catch (ConfigurationException e) {
             assertThat(e.getMessage(), stringContainsInOrder("zero or exactly one", "shiroEnvironmentClass"));
         }
 
-        PowerMock.verifyAll();
         EasyMock.verify(servletContext);
     }
 
@@ -110,14 +90,10 @@ public class EnvironmentLoaderServiceTest {
         expect(servletContext.getInitParameter("shiroEnvironmentClass")).andReturn(WebEnvironmentStub.class.getName());
         expect(servletContext.getInitParameter("shiroConfigLocations")).andReturn(null);
 
-        PowerMock.mockStaticPartialStrict(ServiceLoader.class, "load");
-
         EasyMock.replay(servletContext);
-        PowerMock.replayAll();
 
         WebEnvironment resultEnvironment = new EnvironmentLoader().createEnvironment(servletContext);
 
-        PowerMock.verifyAll();
         EasyMock.verify(servletContext);
 
         assertThat(resultEnvironment, instanceOf(WebEnvironmentStub.class));
diff --git a/.gitignore b/web/src/test/resources/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.ini
similarity index 79%
copy from .gitignore
copy to web/src/test/resources/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.ini
index 42cc59f..e932212 100644
--- a/.gitignore
+++ b/web/src/test/resources/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.ini
@@ -1,3 +1,4 @@
+#
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -14,29 +15,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
-# IntelliJ
-*.ipr
-*.iml
-*.iws
-.idea/
-
-#
-# Eclipse metadata.
-#
-.project
-.classpath
-.settings/
-
-#
-# Eclipse and Maven output folders.
-#
-bin/
-target/
-
-#
-# Maven release metadata
 #
-release.properties
-pom.xml.*
--
+[filters]
+authc.successUrl = /index.jsp