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/13 01:25:56 UTC

[6/6] ISIS-188: renaming packages, now builds ok (not yet tested)

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java b/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java
deleted file mode 100644
index a96861a..0000000
--- a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TestObjectWithCollection.java
+++ /dev/null
@@ -1,108 +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.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/978f79af/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java b/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java
deleted file mode 100644
index d501f26..0000000
--- a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodReturnTest.java
+++ /dev/null
@@ -1,76 +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.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/978f79af/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.java b/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.java
deleted file mode 100644
index 97b6421..0000000
--- a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/TypeExtractorMethodsParametersTest.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.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/978f79af/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java b/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java
deleted file mode 100644
index f9ffb62..0000000
--- a/core/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/userprofile/OptionsTest.java
+++ /dev/null
@@ -1,116 +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.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"));
-    }
-}