Repository: shiro Updated Branches: refs/heads/master d9715bca9 -> 31492eae9
http://git-wip-us.apache.org/repos/asf/shiro/blob/aa2cd4fc/support/spring/src/test/java/org/apache/shiro/spring/config/OptionalComponentsTestConfiguration.java ---------------------------------------------------------------------- diff --git a/support/spring/src/test/java/org/apache/shiro/spring/config/OptionalComponentsTestConfiguration.java b/support/spring/src/test/java/org/apache/shiro/spring/config/OptionalComponentsTestConfiguration.java new file mode 100644 index 0000000..2f71751 --- /dev/null +++ b/support/spring/src/test/java/org/apache/shiro/spring/config/OptionalComponentsTestConfiguration.java @@ -0,0 +1,57 @@ +/* + * 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.spring.config; + +import org.apache.shiro.authz.Permission; +import org.apache.shiro.authz.permission.PermissionResolver; +import org.apache.shiro.authz.permission.RolePermissionResolver; +import org.apache.shiro.authz.permission.WildcardPermission; +import org.apache.shiro.authz.permission.WildcardPermissionResolver; +import org.apache.shiro.cache.CacheManager; +import org.apache.shiro.cache.MemoryConstrainedCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Collection; +import java.util.Collections; + +@Configuration +public class OptionalComponentsTestConfiguration { + + @Bean + CacheManager cacheManager() { + return new MemoryConstrainedCacheManager(); + } + + @Bean + RolePermissionResolver rolePermissionResolver() { + return new RolePermissionResolver() { + @Override + public Collection<Permission> resolvePermissionsInRole(String roleString) { + return Collections.emptySet(); + } + }; + } + + @Bean + PermissionResolver permissionResolver() { + // this permission always resolves to false + return new WildcardPermissionResolver(); + } +} http://git-wip-us.apache.org/repos/asf/shiro/blob/aa2cd4fc/support/spring/src/test/java/org/apache/shiro/spring/config/RealmTestConfiguration.java ---------------------------------------------------------------------- diff --git a/support/spring/src/test/java/org/apache/shiro/spring/config/RealmTestConfiguration.java b/support/spring/src/test/java/org/apache/shiro/spring/config/RealmTestConfiguration.java new file mode 100644 index 0000000..55d7164 --- /dev/null +++ b/support/spring/src/test/java/org/apache/shiro/spring/config/RealmTestConfiguration.java @@ -0,0 +1,44 @@ +/* + * 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.spring.config; + +import org.apache.shiro.realm.Realm; +import org.apache.shiro.realm.text.TextConfigurationRealm; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; + +@Configuration +public class RealmTestConfiguration { + + @Bean +// @DependsOn("lifecycleBeanPostProcessor") + @SuppressWarnings("Duplicates") + Realm getTextConfigurationRealm() { + + TextConfigurationRealm realm = new TextConfigurationRealm(); + realm.setUserDefinitions("joe.coder=password,user\n" + + "jill.coder=password,admin"); + + realm.setRoleDefinitions("admin=read,write\n" + + "user=read"); + realm.setCachingEnabled(true); + return realm; + } +} http://git-wip-us.apache.org/repos/asf/shiro/blob/aa2cd4fc/support/spring/src/test/java/org/apache/shiro/spring/web/config/CacheManagerConfiguration.java ---------------------------------------------------------------------- diff --git a/support/spring/src/test/java/org/apache/shiro/spring/web/config/CacheManagerConfiguration.java b/support/spring/src/test/java/org/apache/shiro/spring/web/config/CacheManagerConfiguration.java new file mode 100644 index 0000000..afaf00b --- /dev/null +++ b/support/spring/src/test/java/org/apache/shiro/spring/web/config/CacheManagerConfiguration.java @@ -0,0 +1,33 @@ +/* + * 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.spring.web.config; + +import org.apache.shiro.cache.CacheManager; +import org.apache.shiro.cache.MemoryConstrainedCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class CacheManagerConfiguration { + + @Bean + CacheManager getCacheManager() { + return new MemoryConstrainedCacheManager(); + } +} http://git-wip-us.apache.org/repos/asf/shiro/blob/aa2cd4fc/test-coverage/pom.xml ---------------------------------------------------------------------- diff --git a/test-coverage/pom.xml b/test-coverage/pom.xml new file mode 100644 index 0000000..f088f32 --- /dev/null +++ b/test-coverage/pom.xml @@ -0,0 +1,97 @@ +<?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. + --> +<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"> + + <parent> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-root</artifactId> + <version>1.4.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <artifactId>shiro-test-coverage</artifactId> + <name>Apache Shiro :: Test Coverage</name> + <packaging>pom</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-web</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-aspectj</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-cas</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-ehcache</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-guice</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-quartz</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-spring</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.shiro</groupId> + <artifactId>shiro-spring-boot-web-starter</artifactId> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <reportSets> + <reportSet> + <id>aggregate-jacoco</id> + <reports> + <report>report</report> + <report>report-integration</report> + <report>report-aggregate</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> + +</project> +
