You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/06 11:10:37 UTC
[50/51] [partial] ISIS-188: moving modules into core
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java
new file mode 100644
index 0000000..a96861a
--- /dev/null
+++ b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java
@@ -0,0 +1,108 @@
+/*
+ * 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.isis.runtimes.dflt.runtime.system;
+
+import java.util.Vector;
+
+public class TestObjectWithCollection extends RuntimeTestPojo {
+
+ private final Vector arrayList;
+ private final boolean throwException;
+
+ public TestObjectWithCollection(final Vector arrayList, final boolean throwException) {
+ this.arrayList = arrayList;
+ this.throwException = throwException;
+ }
+
+ public Object getList() {
+ throwException();
+ return arrayList;
+ }
+
+ public void addToList(final Object object) {
+ throwException();
+ arrayList.add(object);
+ }
+
+ private void throwException() {
+ if (throwException) {
+ throw new Error("cause invocation failure");
+ }
+ }
+
+ public void removeFromList(final Object object) {
+ throwException();
+ arrayList.remove(object);
+ }
+
+ public void clearList() {
+ throwException();
+ arrayList.clear();
+ }
+
+ public String validateAddToList(final Object object) {
+ throwException();
+ if (object instanceof TestObjectWithCollection) {
+ return "can't add this type of object";
+ } else {
+ return null;
+ }
+ }
+
+ public String validateRemoveFromList(final Object object) {
+ throwException();
+ if (object instanceof TestObjectWithCollection) {
+ return "can't remove this type of object";
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((arrayList == null) ? 0 : arrayList.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final TestObjectWithCollection other = (TestObjectWithCollection) obj;
+ if (arrayList == null) {
+ if (other.arrayList != null) {
+ return false;
+ }
+ } else if (!arrayList.equals(other.arrayList)) {
+ return false;
+ }
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java
new file mode 100644
index 0000000..d501f26
--- /dev/null
+++ b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.isis.runtimes.dflt.runtime.system;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.containsElementThat;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.junit.Test;
+
+import org.apache.isis.core.metamodel.specloader.traverser.TypeExtractorMethodReturn;
+
+public class TypeExtractorMethodReturnTest {
+
+ @Test
+ public void shouldFindGenericTypes() throws Exception {
+
+ class Customer {
+ }
+ class CustomerRepository {
+ @SuppressWarnings("unused")
+ public List<Customer> findCustomers() {
+ return null;
+ }
+ }
+
+ final Class<?> clazz = CustomerRepository.class;
+ final Method method = clazz.getMethod("findCustomers");
+
+ final TypeExtractorMethodReturn extractor = new TypeExtractorMethodReturn(method);
+
+ final List<Class<?>> classes = extractor.getClasses();
+ assertThat(classes.size(), is(2));
+ assertThat(classes, containsElementThat(equalTo((Class<?>)java.util.List.class)));
+ assertThat(classes, containsElementThat(equalTo((Class<?>)Customer.class)));
+ }
+
+ @Test
+ public void ignoresVoidType() throws Exception {
+
+ class CustomerRepository {
+ @SuppressWarnings("unused")
+ public void findCustomers() {
+ }
+ }
+
+ final Class<?> clazz = CustomerRepository.class;
+ final Method method = clazz.getMethod("findCustomers");
+
+ final TypeExtractorMethodReturn extractor = new TypeExtractorMethodReturn(method);
+
+ assertThat(extractor.getClasses().size(), is(0));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.java b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.java
new file mode 100644
index 0000000..97b6421
--- /dev/null
+++ b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.isis.runtimes.dflt.runtime.system;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.metamodel.specloader.traverser.TypeExtractorMethodParameters;
+
+public class TypeExtractorMethodsParametersTest {
+
+ @Test
+ public void shouldFindGenericTypes() throws Exception {
+
+ class Customer {
+ }
+ class CustomerRepository {
+ @SuppressWarnings("unused")
+ public void filterCustomers(final List<Customer> customerList) {
+ ;
+ }
+ }
+
+ final Class<?> clazz = CustomerRepository.class;
+ final Method method = clazz.getMethod("filterCustomers", List.class);
+
+ final TypeExtractorMethodParameters extractor = new TypeExtractorMethodParameters(method);
+
+ assertThat(extractor.getClasses().size(), is(2));
+ assertThat(extractor.getClasses(), IsisMatchers.containsElementThat(equalTo(java.util.List.class)));
+ assertThat(extractor.getClasses(), IsisMatchers.containsElementThat(equalTo(Customer.class)));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java
new file mode 100644
index 0000000..f9ffb62
--- /dev/null
+++ b/framework/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.isis.runtimes.dflt.runtime.userprofile;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Iterator;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.core.runtime.userprofile.Options;
+
+public class OptionsTest {
+
+ private Options options;
+ private Options suboptions;
+
+ @Before
+ public void setup() throws Exception {
+ suboptions = new Options();
+ suboptions.addOption("name-3", "value-2");
+
+ options = new Options();
+ options.addOption("test", "value");
+ options.addOption("anInt", "23");
+ options.addOptions("suboptions", suboptions);
+ }
+
+ @Test
+ public void savedValueIsRetrieved() throws Exception {
+ assertEquals("value", options.getString("test"));
+ }
+
+ @Test
+ public void unknownNameIsNull() throws Exception {
+ assertNull(options.getString("unknown"));
+ }
+
+ @Test
+ public void intValue() throws Exception {
+ assertEquals(23, options.getInteger("anInt", 0));
+ }
+
+ @Test
+ public void intDefault() throws Exception {
+ assertEquals(10, options.getInteger("unknown", 10));
+ }
+
+ @Test
+ public void stringDefault() throws Exception {
+ assertEquals("def", options.getString("unknown", "def"));
+ }
+
+ @Test
+ public void debug() throws Exception {
+ final DebugString debug = new DebugString();
+ options.debugData(debug);
+ assertNotNull(debug.toString());
+ }
+
+ @Test
+ public void names() throws Exception {
+ final Iterator<String> names = options.names();
+ assertTrue(names.hasNext());
+ }
+
+ @Test
+ public void copy() throws Exception {
+ final Options copy = new Options();
+ copy.copy(options);
+ assertEquals("value", copy.getString("test"));
+ }
+
+ @Test
+ public void addOptions() throws Exception {
+ final Options suboptions = options.getOptions("suboptions");
+ assertEquals("value-2", suboptions.getString("name-3"));
+ }
+
+ @Test
+ public void emptyWhenOptionsWhenNotFound() throws Exception {
+ final Options suboptions = options.getOptions("unkown");
+ assertFalse(suboptions.names().hasNext());
+ }
+
+ @Test
+ public void newEmptyOptionsAdded() throws Exception {
+ final Options suboptions = options.getOptions("unknown");
+ suboptions.addOption("test", "value");
+ assertSame(suboptions, options.getOptions("unknown"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/NOTICE
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/NOTICE b/framework/core/security-noop/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/core/security-noop/NOTICE
@@ -0,0 +1,7 @@
+Apache Isis
+Copyright 2010-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/pom.xml b/framework/core/security-noop/pom.xml
new file mode 100644
index 0000000..d791d1b
--- /dev/null
+++ b/framework/core/security-noop/pom.xml
@@ -0,0 +1,79 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis</groupId>
+ <artifactId>core</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.isis.security</groupId>
+ <artifactId>dflt</artifactId>
+ <name>Default Security (No-op)</name>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>security-noop/</relativeUrl>
+ </properties>
+
+ <!-- used in Site generation for relative references. -->
+ <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>${maven-project-info-reports-plugin}</version>
+ <inherited>false</inherited>
+ <configuration>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <inherited>false</inherited>
+ <reports>
+ <report>dependency-management</report>
+ <report>dependencies</report>
+ <report>dependency-convergence</report>
+ <report>plugins</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticationRequestDefault.java
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticationRequestDefault.java b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticationRequestDefault.java
new file mode 100644
index 0000000..7254f85
--- /dev/null
+++ b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticationRequestDefault.java
@@ -0,0 +1,29 @@
+/*
+ * 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.isis.security.dflt.authentication;
+
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestAbstract;
+
+public class AuthenticationRequestDefault extends AuthenticationRequestAbstract {
+
+ public AuthenticationRequestDefault(String name) {
+ super(name);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticatorDefault.java
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticatorDefault.java b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticatorDefault.java
new file mode 100644
index 0000000..ab9f601
--- /dev/null
+++ b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/AuthenticatorDefault.java
@@ -0,0 +1,51 @@
+/*
+ * 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.isis.security.dflt.authentication;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticatorAbstract;
+
+/**
+ * Implementation that always authenticates any {@link AuthenticationRequestDefault}.
+ *
+ * <p>
+ * Intended for testing use only.
+ */
+public class AuthenticatorDefault extends AuthenticatorAbstract {
+
+ public AuthenticatorDefault(final IsisConfiguration configuration) {
+ super(configuration);
+ }
+
+ @Override
+ public boolean isValid(final AuthenticationRequest request) {
+ if(!(request instanceof AuthenticationRequestDefault)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean canAuthenticate(final Class<? extends AuthenticationRequest> authenticationRequestClass) {
+ return AuthenticationRequestDefault.class.isAssignableFrom(authenticationRequestClass);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/DefaultAuthenticationManagerInstaller.java
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/DefaultAuthenticationManagerInstaller.java b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/DefaultAuthenticationManagerInstaller.java
new file mode 100644
index 0000000..996a25f
--- /dev/null
+++ b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authentication/DefaultAuthenticationManagerInstaller.java
@@ -0,0 +1,41 @@
+/*
+ * 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.isis.security.dflt.authentication;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.standard.Authenticator;
+import org.apache.isis.runtimes.dflt.runtime.authentication.AuthenticationManagerStandardInstallerAbstractForDfltRuntime;
+
+public class DefaultAuthenticationManagerInstaller extends AuthenticationManagerStandardInstallerAbstractForDfltRuntime {
+
+ public DefaultAuthenticationManagerInstaller() {
+ super("dflt");
+ }
+
+ @Override
+ protected List<Authenticator> createAuthenticators(final IsisConfiguration configuration) {
+ return Lists.<Authenticator> newArrayList(new AuthenticatorDefault(configuration));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/AuthorizorDefault.java
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/AuthorizorDefault.java b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/AuthorizorDefault.java
new file mode 100644
index 0000000..c2eaf94
--- /dev/null
+++ b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/AuthorizorDefault.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.isis.security.dflt.authorization;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.runtime.authorization.standard.Authorizor;
+
+public class AuthorizorDefault implements Authorizor {
+
+ @Override
+ public void init() {
+ // does nothing
+ }
+
+ @Override
+ public void shutdown() {
+ // does nothing
+ }
+
+ @Override
+ public boolean isUsableInRole(final String role, final Identifier identifier) {
+ return true;
+ }
+
+ @Override
+ public boolean isVisibleInRole(final String user, final Identifier identifier) {
+ return true;
+ }
+
+ @Override
+ public boolean isVisibleInAnyRole(Identifier identifier) {
+ return true;
+ }
+
+ @Override
+ public boolean isUsableInAnyRole(Identifier identifier) {
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/DefaultAuthorizationManagerInstaller.java
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/DefaultAuthorizationManagerInstaller.java b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/DefaultAuthorizationManagerInstaller.java
new file mode 100644
index 0000000..16dffb3
--- /dev/null
+++ b/framework/core/security-noop/src/main/java/org/apache/isis/security/dflt/authorization/DefaultAuthorizationManagerInstaller.java
@@ -0,0 +1,37 @@
+/*
+ * 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.isis.security.dflt.authorization;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authorization.standard.AuthorizationManagerStandardInstallerAbstract;
+import org.apache.isis.core.runtime.authorization.standard.Authorizor;
+
+public class DefaultAuthorizationManagerInstaller extends AuthorizationManagerStandardInstallerAbstract {
+
+ public DefaultAuthorizationManagerInstaller() {
+ super("dflt");
+ }
+
+ @Override
+ protected Authorizor createAuthorizor(final IsisConfiguration configuration) {
+ return new AuthorizorDefault();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/site/apt/index.apt b/framework/core/security-noop/src/site/apt/index.apt
new file mode 100644
index 0000000..b7ad1a4
--- /dev/null
+++ b/framework/core/security-noop/src/site/apt/index.apt
@@ -0,0 +1,42 @@
+~~ 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.
+
+
+
+Default Security (No-op)
+
+ The <default security> module provides a stub implementation of Isis' authentication and
+ authorization APIs. The authentation will accept any credentials as valid, and authorization will
+ grant all permissions.
+
+ This makes the default security implementation only suitable for prototyping and unit testing,
+ when security is not of concern. For deployment you will typically need to configure one of
+ the alternative implementations.
+
+
+Alternatives
+
+ Alternatives include:
+
+ * the {{{../file/index.html}file-based}} security (reading from simple flat files)
+
+ * the {{{../ldap/index.html}LDAP}} security
+
+ * the {{{../sql/index.html}SQL}} security (reading from simple SQL tables)
+
+ []
+
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/site/apt/jottings.apt b/framework/core/security-noop/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/core/security-noop/src/site/apt/jottings.apt
@@ -0,0 +1,24 @@
+~~ 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.
+
+
+
+Jottings
+
+ This page is to capture any random jottings relating to this module prior
+ to being moved into formal documentation.
+
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/security-noop/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/core/security-noop/src/site/site.xml b/framework/core/security-noop/src/site/site.xml
new file mode 100644
index 0000000..bcc083c
--- /dev/null
+++ b/framework/core/security-noop/src/site/site.xml
@@ -0,0 +1,41 @@
+<?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>
+
+ <body>
+ <breadcrumbs>
+ <item name="Default" href="index.html"/>
+ </breadcrumbs>
+
+ <menu name="Default Security">
+ <item name="About" href="index.html" />
+ <item name="Jottings" href="jottings.html" />
+ </menu>
+
+ <menu name="Security Modules">
+ <item name="Default (No-op)" href="../dflt/index.html" />
+ <item name="File" href="../file/index.html" />
+ <item name="LDAP" href="../ldap/index.html" />
+ <item name="SQL" href="../sql/index.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports"/>
+ </body>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/NOTICE
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/NOTICE b/framework/core/testsupport/NOTICE
deleted file mode 100644
index d391f54..0000000
--- a/framework/core/testsupport/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache Isis
-Copyright 2010-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/pom.xml b/framework/core/testsupport/pom.xml
deleted file mode 100644
index e8c7fa3..0000000
--- a/framework/core/testsupport/pom.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis</groupId>
- <artifactId>core</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-unittestsupport</artifactId>
- <name>Core Test Support</name>
-
- <description>
- Support for writing unit tests; should be added as a dependency
- with scope=test only
- </description>
-
- <properties>
- <siteBaseDir>../..</siteBaseDir>
- <relativeUrl>core/testsupport/</relativeUrl>
- </properties>
-
- <!-- used in Site generation for relative references. -->
- <url>http://incubator.apache.org/isis/${relativeUrl}</url>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>${maven-project-info-reports-plugin}</version>
- <inherited>false</inherited>
- <configuration>
- <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
- </configuration>
- <reportSets>
- <reportSet>
- <inherited>false</inherited>
- <reports>
- <report>dependencies</report>
- <report>dependency-convergence</report>
- <report>plugins</report>
- <report>summary</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- </plugins>
- </reporting>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jmock</groupId>
- <artifactId>jmock</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jmock</groupId>
- <artifactId>jmock-junit4</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jmock</groupId>
- <artifactId>jmock-legacy</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/files/Files.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/files/Files.java b/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/files/Files.java
deleted file mode 100644
index aafac91..0000000
--- a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/files/Files.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.isis.core.testsupport.files;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-
-public final class Files {
-
- Files() {
- }
-
- // /////////////////////////////////////////////////////
- // delete files
- // /////////////////////////////////////////////////////
-
- public enum Recursion {
- DO_RECURSE, DONT_RECURSE
- }
-
- /**
- *
- * @param directoryName
- * directory to start deleting from
- * @param filePrefix
- * file name prefix (no wild cards)
- * @param recursion
- */
- public static void deleteFilesWithPrefix(final String directoryName, final String filePrefix, Recursion recursion) {
- deleteFiles(directoryName, filterFileNamePrefix(filePrefix), recursion);
- }
-
- public static void deleteFiles(final String directoryName, final String fileExtension, Recursion recursion) {
- deleteFiles(directoryName, filterFileNameExtension(fileExtension), recursion);
- }
-
- public static void deleteFiles(final File directory, final String fileExtension, Recursion recursion) {
- deleteFiles(directory, filterFileNameExtension(fileExtension), recursion);
- }
-
- public static void deleteFiles(final String directoryName, final FilenameFilter filter, Recursion recursion) {
- final File dir = new File(directoryName);
- deleteFiles(dir, filter, recursion);
- }
-
- public static void deleteFiles(final File directory, final FilenameFilter filter, Recursion recursion) {
- deleteFiles(directory, filter, recursion, new Deleter() {
- @Override
- public void deleteFile(File f) {
- f.delete();
- }
- });
- }
-
- // introduced for testing of this utility class.
- interface Deleter {
- void deleteFile(File f);
- }
-
- static void deleteFiles(final File directory, final FilenameFilter filter, Recursion recursion, Deleter deleter) {
- try {
- for (final File file : directory.listFiles(filter)) {
- deleter.deleteFile(file);
- }
- } catch (NullPointerException e) {
- }
-
- if (recursion == Recursion.DO_RECURSE) {
- try {
- for (final File subdir : directory.listFiles(filterDirectory())) {
- deleteFiles(subdir, filter, recursion, deleter);
- }
- } catch (NullPointerException e) {
- }
- }
- }
-
- // /////////////////////////////////////////////////////
- // filters
- // /////////////////////////////////////////////////////
-
- public static FilenameFilter and(final FilenameFilter... filters) {
- return new FilenameFilter() {
-
- @Override
- public boolean accept(File dir, String name) {
- for (FilenameFilter filter : filters) {
- if (!filter.accept(dir, name)) {
- return false;
- }
- }
- return true;
- }
- };
- }
-
- public static FilenameFilter filterFileNameExtension(final String fileExtension) {
- return new FilenameFilter() {
-
- @Override
- public boolean accept(final File arg0, final String arg1) {
- return arg1.endsWith(fileExtension);
- }
- };
- }
-
- public static FilenameFilter filterFileNamePrefix(final String filePrefix) {
- return new FilenameFilter() {
-
- @Override
- public boolean accept(final File arg0, final String arg1) {
- return arg1.startsWith(filePrefix);
- }
- };
- }
-
- public static FileFilter filterDirectory() {
- return new FileFilter() {
- @Override
- public boolean accept(File arg0) {
- return arg0.isDirectory();
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java b/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java
deleted file mode 100644
index b0793e1..0000000
--- a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.isis.core.testsupport.jmock;
-
-import java.lang.reflect.Method;
-
-import org.hamcrest.Description;
-import org.jmock.api.Action;
-import org.jmock.api.Invocation;
-
-public final class InjectIntoJMockAction implements Action {
- @Override
- public void describeTo(final Description description) {
- description.appendText("inject self");
- }
-
- // x.injectInto(y) ---> y.setXxx(x)
- @Override
- public Object invoke(final Invocation invocation) throws Throwable {
- final Object injectable = invocation.getInvokedObject();
- final Object toInjectInto = invocation.getParameter(0);
- final Method[] methods = toInjectInto.getClass().getMethods();
- for (final Method method : methods) {
- if (!method.getName().startsWith("set")) {
- continue;
- }
- if (method.getParameterTypes().length != 1) {
- continue;
- }
- final Class<?> methodParameterType = method.getParameterTypes()[0];
- if (methodParameterType.isAssignableFrom(injectable.getClass())) {
- method.invoke(toInjectInto, injectable);
- break;
- }
- }
- return null;
- }
-
- /**
- * Factory
- */
- public static Action injectInto() {
- return new InjectIntoJMockAction();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/IsisActions.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/IsisActions.java b/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/IsisActions.java
deleted file mode 100644
index 777efaf..0000000
--- a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/IsisActions.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.isis.core.testsupport.jmock;
-
-import org.jmock.api.Action;
-
-public final class IsisActions {
-
- private IsisActions() {
- }
-
- public static Action injectInto() {
- return InjectIntoJMockAction.injectInto();
- }
-
- public static <T> Action returnEach(final T... values) {
- return ReturnEachAction.returnEach(values);
- }
-
- public static Action returnArgument(final int i) {
- return ReturnArgumentJMockAction.returnArgument(i);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java b/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java
deleted file mode 100644
index d88de45..0000000
--- a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JUnitRuleMockery2.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.isis.core.testsupport.jmock;
-
-import org.jmock.Expectations;
-import org.jmock.integration.junit4.JUnitRuleMockery;
-import org.jmock.lib.legacy.ClassImposteriser;
-
-/**
- * Use as a <tt>@Rule</tt>, meaning that the <tt>@RunWith(JMock.class)</tt> can
- * be ignored.
- *
- * <pre>
- * public class MyTest {
- *
- * @Rule
- * public final Junit4Mockery2 context = Junit4Mockery2.createFor(Mode.INTERFACES);
- *
- * }
- * </pre>
- *
- * <p>
- * The class also adds some convenience methods, and uses a factory method to
- * make it explicit whether the context can mock only interfaces or interfaces
- * and classes.
- */
-public class JUnitRuleMockery2 extends JUnitRuleMockery {
-
- public static enum Mode {
- INTERFACES_ONLY, INTERFACES_AND_CLASSES;
- }
-
- /**
- * Factory method.
- */
- public static JUnitRuleMockery2 createFor(final Mode mode) {
- final JUnitRuleMockery2 jUnitRuleMockery2 = new JUnitRuleMockery2();
- if (mode == Mode.INTERFACES_AND_CLASSES) {
- jUnitRuleMockery2.setImposteriser(ClassImposteriser.INSTANCE);
- }
- return jUnitRuleMockery2;
- }
-
- private JUnitRuleMockery2() {
- }
-
- /**
- * Ignoring any interaction with the mock; an allowing/ignoring mock will be
- * returned in turn.
- */
- public <T> T ignoring(final T mock) {
- checking(new Expectations() {
- {
- ignoring(mock);
- }
- });
- return mock;
- }
-
- /**
- * Allow any interaction with the mock; an allowing mock will be returned in
- * turn.
- */
- public <T> T allowing(final T mock) {
- checking(new Expectations() {
- {
- allowing(mock);
- }
- });
- return mock;
- }
-
- /**
- * Prohibit any interaction with the mock.
- */
- public <T> T never(final T mock) {
- checking(new Expectations() {
- {
- never(mock);
- }
- });
- return mock;
- }
-
- /**
- * Ignore a set of mocks.
- */
- public void ignoring(Object... mocks) {
- for (Object mock : mocks) {
- ignoring(mock);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java b/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java
deleted file mode 100644
index 9c35ebf..0000000
--- a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.isis.core.testsupport.jmock;
-
-import org.hamcrest.Description;
-import org.jmock.api.Action;
-import org.jmock.api.Invocation;
-
-public final class ReturnArgumentJMockAction implements Action {
- private final int i;
-
- public ReturnArgumentJMockAction(final int i) {
- this.i = i;
- }
-
- @Override
- public void describeTo(final Description description) {
- description.appendText("parameter #" + i + " ");
- }
-
- @Override
- public Object invoke(final Invocation invocation) throws Throwable {
- return invocation.getParameter(i);
- }
-
- /**
- * Factory
- */
- public static Action returnArgument(final int i) {
- return new ReturnArgumentJMockAction(i);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnEachAction.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnEachAction.java b/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnEachAction.java
deleted file mode 100644
index 9b54424..0000000
--- a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnEachAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.isis.core.testsupport.jmock;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.hamcrest.Description;
-import org.jmock.api.Action;
-import org.jmock.api.Invocation;
-
-public class ReturnEachAction<T> implements Action {
-
- private final Collection<T> collection;
- private final Iterator<T> iterator;
-
- public ReturnEachAction(Collection<T> collection) {
- this.collection = collection;
- this.iterator = collection.iterator();
- }
-
- public ReturnEachAction(T... array) {
- this(Arrays.asList(array));
- }
-
- public T invoke(Invocation invocation) throws Throwable {
- return iterator.next();
- }
-
- public void describeTo(Description description) {
- description.appendValueList("return iterator.next() over ", ", ", "", collection);
- }
-
- /**
- * Factory
- */
- public static <T> Action returnEach(final T... values) {
- return new ReturnEachAction<T>(values);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java b/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java
deleted file mode 100644
index dd0dc85..0000000
--- a/framework/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.isis.core.testsupport.value;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Contract test for value types ({@link #equals(Object)} and
- * {@link #hashCode()}).
- */
-public abstract class ValueTypeContractTestAbstract<T> {
-
- @Before
- public void setUp() throws Exception {
- assertSizeAtLeast(getObjectsWithSameValue(), 2);
- assertSizeAtLeast(getObjectsWithDifferentValue(), 1);
- }
-
- private void assertSizeAtLeast(final List<T> objects, final int i) {
- assertThat(objects, is(notNullValue()));
- assertThat(objects.size(), is(greaterThan(i - 1)));
- }
-
- @Test
- public void notEqualToNull() throws Exception {
- for (final T o1 : getObjectsWithSameValue()) {
- assertThat(o1.equals(null), is(false));
- }
- for (final T o1 : getObjectsWithDifferentValue()) {
- assertThat(o1.equals(null), is(false));
- }
- }
-
- @Test
- public void reflexiveAndSymmetric() throws Exception {
- for (final T o1 : getObjectsWithSameValue()) {
- for (final T o2 : getObjectsWithSameValue()) {
- assertThat(o1.equals(o2), is(true));
- assertThat(o2.equals(o1), is(true));
- assertThat(o1.hashCode(), is(equalTo(o2.hashCode())));
- }
- }
- }
-
- @Test
- public void notEqual() throws Exception {
- for (final T o1 : getObjectsWithSameValue()) {
- for (final T o2 : getObjectsWithDifferentValue()) {
- assertThat(o1.equals(o2), is(false));
- assertThat(o2.equals(o1), is(false));
- }
- }
- }
-
- @Test
- public void transitiveWhenEqual() throws Exception {
- for (final T o1 : getObjectsWithSameValue()) {
- for (final T o2 : getObjectsWithSameValue()) {
- for (final Object o3 : getObjectsWithSameValue()) {
- assertThat(o1.equals(o2), is(true));
- assertThat(o2.equals(o3), is(true));
- assertThat(o1.equals(o3), is(true));
- }
- }
- }
- }
-
- protected abstract List<T> getObjectsWithSameValue();
-
- protected abstract List<T> getObjectsWithDifferentValue();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java b/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java
deleted file mode 100644
index 65b4058..0000000
--- a/framework/core/testsupport/src/main/java/org/jmock/auto/Auto.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-/**
-Copyright (c) 2000-2007, jMock.org
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of
-conditions and the following disclaimer. Redistributions in binary form must reproduce
-the above copyright notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the distribution.
-
-Neither the name of jMock nor the names of its contributors may be used to endorse
-or promote products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
- */
-package org.jmock.auto;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Retention(RUNTIME)
-@Target(FIELD)
-public @interface Auto {
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java b/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java
deleted file mode 100644
index 33dc7e4..0000000
--- a/framework/core/testsupport/src/main/java/org/jmock/auto/Mock.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-/**
-Copyright (c) 2000-2007, jMock.org
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of
-conditions and the following disclaimer. Redistributions in binary form must reproduce
-the above copyright notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the distribution.
-
-Neither the name of jMock nor the names of its contributors may be used to endorse
-or promote products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
- */
-package org.jmock.auto;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Retention(RUNTIME)
-@Target(FIELD)
-public @interface Mock {
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/jmock/auto/internal/AllDeclaredFields.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/jmock/auto/internal/AllDeclaredFields.java b/framework/core/testsupport/src/main/java/org/jmock/auto/internal/AllDeclaredFields.java
deleted file mode 100644
index 26e8d99..0000000
--- a/framework/core/testsupport/src/main/java/org/jmock/auto/internal/AllDeclaredFields.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-/**
-Copyright (c) 2000-2007, jMock.org
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of
-conditions and the following disclaimer. Redistributions in binary form must reproduce
-the above copyright notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the distribution.
-
-Neither the name of jMock nor the names of its contributors may be used to endorse
-or promote products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
- */
-package org.jmock.auto.internal;
-
-import static java.util.Arrays.asList;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-
-public class AllDeclaredFields {
- public static List<Field> in(final Class<?> clazz) {
- final ArrayList<Field> fields = new ArrayList<Field>();
- for (Class<?> c = clazz; c != Object.class; c = c.getSuperclass()) {
- fields.addAll(asList(c.getDeclaredFields()));
- }
- return fields;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/jmock/auto/internal/Mockomatic.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/jmock/auto/internal/Mockomatic.java b/framework/core/testsupport/src/main/java/org/jmock/auto/internal/Mockomatic.java
deleted file mode 100644
index 6505eb7..0000000
--- a/framework/core/testsupport/src/main/java/org/jmock/auto/internal/Mockomatic.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.
- */
-/**
-Copyright (c) 2000-2007, jMock.org
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of
-conditions and the following disclaimer. Redistributions in binary form must reproduce
-the above copyright notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the distribution.
-
-Neither the name of jMock nor the names of its contributors may be used to endorse
-or promote products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
- */
-package org.jmock.auto.internal;
-
-import java.lang.reflect.Field;
-import java.util.List;
-
-import org.jmock.Mockery;
-import org.jmock.Sequence;
-import org.jmock.States;
-import org.jmock.auto.Auto;
-import org.jmock.auto.Mock;
-
-public class Mockomatic {
- private final Mockery mockery;
-
- public Mockomatic(final Mockery mockery) {
- this.mockery = mockery;
- }
-
- public void fillIn(final Object object) {
- fillIn(object, AllDeclaredFields.in(object.getClass()));
- }
-
- public void fillIn(final Object object, final List<Field> knownFields) {
- for (final Field field : knownFields) {
- if (field.isAnnotationPresent(Mock.class)) {
- autoMock(object, field);
- } else if (field.isAnnotationPresent(Auto.class)) {
- autoInstantiate(object, field);
- }
- }
- }
-
- private void autoMock(final Object object, final Field field) {
- setAutoField(field, object, mockery.mock(field.getType(), field.getName()), "auto-mock field " + field.getName());
- }
-
- private void autoInstantiate(final Object object, final Field field) {
- final Class<?> type = field.getType();
- if (type == States.class) {
- autoInstantiateStates(field, object);
- } else if (type == Sequence.class) {
- autoInstantiateSequence(field, object);
- } else {
- throw new IllegalStateException("cannot auto-instantiate field of type " + type.getName());
- }
- }
-
- private void autoInstantiateStates(final Field field, final Object object) {
- setAutoField(field, object, mockery.states(field.getName()), "auto-instantiate States field " + field.getName());
- }
-
- private void autoInstantiateSequence(final Field field, final Object object) {
- setAutoField(field, object, mockery.sequence(field.getName()), "auto-instantiate Sequence field " + field.getName());
- }
-
- private void setAutoField(final Field field, final Object object, final Object value, final String description) {
- try {
- field.setAccessible(true);
- field.set(object, value);
- } catch (final IllegalAccessException e) {
- throw new IllegalStateException("cannot " + description, e);
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/main/java/org/jmock/integration/junit4/JUnitRuleMockery.java
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/main/java/org/jmock/integration/junit4/JUnitRuleMockery.java b/framework/core/testsupport/src/main/java/org/jmock/integration/junit4/JUnitRuleMockery.java
deleted file mode 100644
index 9aa0648..0000000
--- a/framework/core/testsupport/src/main/java/org/jmock/integration/junit4/JUnitRuleMockery.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.
- */
-/**
-Copyright (c) 2000-2007, jMock.org
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list of
-conditions and the following disclaimer. Redistributions in binary form must reproduce
-the above copyright notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the distribution.
-
-Neither the name of jMock nor the names of its contributors may be used to endorse
-or promote products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
- */
-package org.jmock.integration.junit4;
-
-import static org.junit.Assert.fail;
-
-import java.lang.reflect.Field;
-import java.util.List;
-
-import org.jmock.auto.internal.AllDeclaredFields;
-import org.jmock.auto.internal.Mockomatic;
-import org.junit.rules.MethodRule;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-/**
- * A <code>JUnitRuleMockery</code> is a JUnit Rule that manages JMock
- * expectations and allowances, and asserts that expectations have been met
- * after each test has finished. To use it, add a field to the test class (note
- * that you don't have to specify <code>@RunWith(JMock.class)</code> any more).
- * For example,
- *
- * <pre>
- * public class ATestWithSatisfiedExpectations {
- * @Rule
- * public final JUnitRuleMockery context = new JUnitRuleMockery();
- * private final Runnable runnable = context.mock(Runnable.class);
- *
- * @Test
- * public void doesSatisfyExpectations() {
- * context.checking(new Expectations() {
- * {
- * oneOf(runnable).run();
- * }
- * });
- *
- * runnable.run();
- * }
- * }
- * </pre>
- *
- * Note that the Rule field must be declared public and as a
- * <code>JUnitRuleMockery</code> (not a <code>Mockery</code>) for JUnit to
- * recognise it, as it's checked statically.
- *
- * @author smgf
- */
-public class JUnitRuleMockery extends JUnit4Mockery implements MethodRule {
- private final Mockomatic mockomatic = new Mockomatic(this);
-
- @Override
- public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- prepare(target);
- base.evaluate();
- assertIsSatisfied();
- }
-
- private void prepare(final Object target) {
- final List<Field> allFields = AllDeclaredFields.in(target.getClass());
- assertOnlyOneJMockContextIn(allFields);
- fillInAutoMocks(target, allFields);
- }
-
- private void assertOnlyOneJMockContextIn(final List<Field> allFields) {
- Field contextField = null;
- for (final Field field : allFields) {
- if (JUnitRuleMockery.class.isAssignableFrom(field.getType())) {
- if (null != contextField) {
- fail("Test class should only have one JUnitRuleMockery field, found " + contextField.getName() + " and " + field.getName());
- }
- contextField = field;
- }
- }
- }
-
- private void fillInAutoMocks(final Object target, final List<Field> allFields) {
- mockomatic.fillIn(target, allFields);
- }
- };
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/site/apt/index.apt b/framework/core/testsupport/src/site/apt/index.apt
deleted file mode 100644
index 7bc90a7..0000000
--- a/framework/core/testsupport/src/site/apt/index.apt
+++ /dev/null
@@ -1,31 +0,0 @@
-~~ 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.
-
-
-
-Test Support
-
- The <testsupport> module holds helper classes to support writing unit
- tests in either {{{http://junit.org}JUnit}} or {{{http://jmock.org}JMock}}.
-
- It should only ever be added as a dependency with a <<<scope>>> of <test>.
-
-Documentation
-
- See the {{{../index.html}core}} documentation
- ({{{../docbkx/html/guide/isis-core.html}HTML}} or
- {{{../docbkx/pdf/isis-core.pdf}PDF}}).
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/site/apt/jottings.apt b/framework/core/testsupport/src/site/apt/jottings.apt
deleted file mode 100644
index c5d1200..0000000
--- a/framework/core/testsupport/src/site/apt/jottings.apt
+++ /dev/null
@@ -1,24 +0,0 @@
-~~ 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.
-
-
-
-Jottings
-
- This page is to capture any random jottings relating to this module prior
- to being moved into formal documentation.
-
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/testsupport/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/core/testsupport/src/site/site.xml b/framework/core/testsupport/src/site/site.xml
deleted file mode 100644
index 69e18b2..0000000
--- a/framework/core/testsupport/src/site/site.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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>
-
- <body>
- <breadcrumbs>
- <item name="Test Support" href="index.html"/>
- </breadcrumbs>
-
- <menu name="Test Support">
- <item name="About" href="index.html" />
- <item name="Jottings" href="jottings.html" />
- </menu>
-
- <menu name="Core Modules">
- <item name="Core Test Support" href="../testsupport/index.html" />
- <item name="Core Commons" href="../commons/index.html" />
- <item name="Core Metamodel" href="../metamodel/index.html" />
- <item name="Core Progmodel" href="../progmodel/index.html" />
- <item name="Core Runtime" href="../runtime/index.html" />
- <item name="Core Webapp" href="../webapp/index.html" />
- </menu>
-
- <menu name="Maven Reports" ref="reports"/>
- </body>
-</project>