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 2013/06/06 12:16:08 UTC

svn commit: r1490226 - in /isis/site/trunk/content: components/security/ components/viewers/restfulobjects/release-notes/ contributors/ core/ getting-started/resources/

Author: danhaywood
Date: Thu Jun  6 10:16:07 2013
New Revision: 1490226

URL: http://svn.apache.org/r1490226
Log:
updated isis-templates.xml, page on unit test support; misc edits from the 1.2.0 release

Modified:
    isis/site/trunk/content/components/security/about.md
    isis/site/trunk/content/components/viewers/restfulobjects/release-notes/isis-viewer-restfulobjects-2.0.0.md
    isis/site/trunk/content/contributors/release-process.md
    isis/site/trunk/content/core/unittestsupport.md
    isis/site/trunk/content/getting-started/resources/isis-templates.xml

Modified: isis/site/trunk/content/components/security/about.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/components/security/about.md?rev=1490226&r1=1490225&r2=1490226&view=diff
==============================================================================
--- isis/site/trunk/content/components/security/about.md (original)
+++ isis/site/trunk/content/components/security/about.md Thu Jun  6 10:16:07 2013
@@ -1,8 +1,6 @@
 Title: Security Implementations
 
-- [File-based Security](file/about.html)
 - [Shiro Security](shiro/about.html)
-- [LDAP Security](ldap/about.html)
-- [SQL Security](sql/about.html)
+- [File-based Security](file/about.html)
 
 

Modified: isis/site/trunk/content/components/viewers/restfulobjects/release-notes/isis-viewer-restfulobjects-2.0.0.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/components/viewers/restfulobjects/release-notes/isis-viewer-restfulobjects-2.0.0.md?rev=1490226&r1=1490225&r2=1490226&view=diff
==============================================================================
--- isis/site/trunk/content/components/viewers/restfulobjects/release-notes/isis-viewer-restfulobjects-2.0.0.md (original)
+++ isis/site/trunk/content/components/viewers/restfulobjects/release-notes/isis-viewer-restfulobjects-2.0.0.md Thu Jun  6 10:16:07 2013
@@ -19,4 +19,3 @@ Title: viewer-restfulobjects-2.0.0
 <li>[<a href='https://issues.apache.org/jira/browse/ISIS-387'>ISIS-387</a>] -         Enhance PublishingService and AuditingService for created and deleted objects (as well as just updated objects).
 </li>
 </ul>                          
-

Modified: isis/site/trunk/content/contributors/release-process.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/contributors/release-process.md?rev=1490226&r1=1490225&r2=1490226&view=diff
==============================================================================
--- isis/site/trunk/content/contributors/release-process.md (original)
+++ isis/site/trunk/content/contributors/release-process.md Thu Jun  6 10:16:07 2013
@@ -914,23 +914,36 @@ For example, for a release of Apache Isi
 And use the following body (summarizing the main points as required):
 
 <pre>
-The Isis team is pleased to announce the release of
-Apache Isis Core version 1.2.3
+The Isis team is pleased to announce the release of:
+- Apache Isis Core version 1.2.0
+- Wicket Viewer 1.2.0
+- Restful Objects Viewer 2.0.0
+- JDO Object Store 1.1.0
+- Shiro Security 1.1.1
+- File Security 1.0.1
+- Quickstart Archetype 1.0.3
 
-<i>summary of the main points of the release</i>
+New features in this release include:
+- ...
 
-Full release notes are available at [1] on the Isis website.
+Full release notes are available at [1,2,3,4,5,6,7] on the Isis website.
 
-You can access this release directly from the Maven central repo [2], 
-or download the release and build it from source [3].
+You can access this release directly from the Maven central repo [8], 
+or download the release and build it from source [9].
 
 Enjoy!
 
 -The Isis team
 
-[1] http://isis.apache.org/core/release-notes/isis-1.2.3.html
-[2] http://search.maven.org
-[3] http://isis.apache.org/download.html
+[1] http://isis.apache.org/core/release-notes/isis-1.2.0.html
+[2] http://isis.apache.org/components/viewers/wicket/release-notes/isis-viewer-wicket-1.2.0.html
+[3] http://isis.apache.org/components/viewers/restfulobjects/release-notes/isis-viewer-restfulobjects-2.0.0.html
+[4] http://isis.apache.org/components/objectstores/jdo/release-notes/isis-objectstore-jdo-1.1.0.html
+[5] http://isis.apache.org/components/security/shiro/release-notes/isis-security-shiro-1.1.1.html
+[6] http://isis.apache.org/components/security/file/release-notes/isis-security-file-1.0.1.html
+[7] http://isis.apache.org/getting-started/release-notes/quickstart_wrj-archetype-1.0.3.html
+[8] http://search.maven.org
+[9] http://isis.apache.org/download.html
 </pre>
 
 ### Blog post

Modified: isis/site/trunk/content/core/unittestsupport.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/core/unittestsupport.md?rev=1490226&r1=1490225&r2=1490226&view=diff
==============================================================================
--- isis/site/trunk/content/core/unittestsupport.md (original)
+++ isis/site/trunk/content/core/unittestsupport.md Thu Jun  6 10:16:07 2013
@@ -1,7 +1,104 @@
 Title: Unit Test Support
 
-{stub
-This page is a stub.
+This module provides unit test helpers for use by all other modules.  There are also utilities that you may find useful in testing your domain objects:
+
+To use, update the `pom.xml`:
+
+<pre>
+    &lt;dependency&gt;
+        &lt;groupId&gt;org.apache.isis.core&lt;/groupId&gt;
+        &lt;artifactId&gt;isis-core-unittestsupport&lt;/artifactId&gt;
+    &lt;/dependency&gt;
+</pre>
+
+
+##Bidirectional Contract Tests [1.3.0-SNAPSHOT]
+
+Automatically tests that bidirectional 1:m or 1:1 associations are being maintained correctly (assuming that they follow the [mutual registration pattern](../applib-guide/how-tos/how-to-04-060-How-to-set-up-and-maintain-bidirectional-relationships.html)
+
+{note
+Isis provides [Eclipse templates](../getting-started/editor-templates.html) to help generate the necessary boilerplate.
+}
+
+For example, suppose that `ParentDomainObject` and `ChildDomainObject` have a 1:m relationship (`ParentDomainObject#children` / `ChildDomainObject#parent`), and also `PeerDomainObject` has a 1:1 relationship with itself (`PeerDomainObject#next` / `PeerDomainObject#previous`).  
+
+The following will exercise these relationships:
+
+<pre>
+public class BidirectionalRelationshipContractTestAll extends BidirectionalRelationshipContractTestAbstract {
+
+    public BidirectionalRelationshipContractTestAll() {
+        super("org.apache.isis.core.unittestsupport.bidir", 
+                ImmutableMap.<Class<?>,Instantiator>of(
+                    // no instantiator need be registered for ParentDomainObject.class; 
+                    // will default to using new InstantiatorSimple(AgreementForTesting.class),
+                    ChildDomainObject.class, new InstantiatorForChildDomainObject(),
+                    PeerDomainObject.class, new InstantiatorSimple(PeerDomainObjectForTesting.class)
+                ));
+        withLoggingTo(System.out);
+    }
+}
+</pre>
+
+As you can see, for some of the types an `Instantiator` must be provided.  This has two main purposes.  First, for abstract classes, it nominates an alternative concrete class to be instantiated.  Second, for classes (such as `ChildDomainObject`) that are `Comparable` and are held in a `SortedSet`), it provides the ability to ensure that different instances are unique when compared against each other.
+
+So you can see what's going on, this will log all tests to `System.out`.  This can be disabled by removing the call to `withLoggingTo()`.
+
+
+
+##JUnitRuleMockery2
+
+An extension to the JMock's `JunitRuleMockery`, providing a simpler API and also providing support for autowiring.
+
+For example, here we see that the class under test, an instance of `CollaboratingUsingSetterInjection`, is automatically wired up with its `Collaborator`:
+
+<pre>
+public class JUnitRuleMockery2Test_autoWiring_setterInjection_happyCase {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private Collaborator collaborator;
+
+    @ClassUnderTest
+    private CollaboratingUsingSetterInjection collaborating;
+
+    @Before
+    public void setUp() throws Exception {
+    	collaborating = context.getClassUnderTest();
+    }
+    
+    @Test
+    public void wiring() {
+    	assertThat(collaborating.collaborator, is(not(nullValue())));
+    }
+}
+</pre>
+
+
+The example tests can be found [here](https://github.com/apache/isis/tree/master/core/unittestsupport/src/test/java/org/apache/isis/core/unittestsupport/jmocking)
+
+##ValueTypeContractTestAbstract
+
+Automatically tests that a custom value type implements `equals()` and `hashCode()` correctly.
+
+For example, testing JDK's own `java.math.BigInteger` can be done as follows:
+
+<pre>
+public class ValueTypeContractTestAbstract_BigIntegerTest extends ValueTypeContractTestAbstract<BigInteger> {
+
+    @Override
+    protected List<BigInteger> getObjectsWithSameValue() {
+        return Arrays.asList(new BigInteger("1"), new BigInteger("1"));
+    }
+
+    @Override
+    protected List<BigInteger> getObjectsWithDifferentValue() {
+        return Arrays.asList(new BigInteger("2"));
+    }
+
 }
+</pre>
 
-This module provides unit test helpers for use by all other modules.
+The example unit tests can be found [here](https://github.com/apache/isis/tree/master/core/unittestsupport/src/test/java/org/apache/isis/core/unittestsupport/value).

Modified: isis/site/trunk/content/getting-started/resources/isis-templates.xml
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/getting-started/resources/isis-templates.xml?rev=1490226&r1=1490225&r2=1490226&view=diff
==============================================================================
--- isis/site/trunk/content/getting-started/resources/isis-templates.xml (original)
+++ isis/site/trunk/content/getting-started/resources/isis-templates.xml Thu Jun  6 10:16:07 2013
@@ -1,23 +1,4 @@
-<?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.
--->
-<templates><template autoinsert="true" context="java-members" deleted="false" description="Action" enabled="true" name="isa">// {{ ${actionName} (action)&#13;
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java-members" deleted="false" description="Action" enabled="true" name="isa">// {{ ${actionName} (action)&#13;
 ${:import(org.apache.isis.applib.annotation.MemberOrder)}@MemberOrder(sequence="1")&#13;
 public ${ReturnType} ${actionName}(final ${ParameterType} ${parameterType}) {&#13;
 	return ${cursor}null; // TODO: business logic here&#13;
@@ -243,12 +224,15 @@ public void set${PropertyName}(final ${P
 		${parentPropertyName}.equals(current${ParentPropertyName})) {&#13;
 		return;&#13;
 	}&#13;
-	// delegate to parent to associate&#13;
+	// delegate to parent(s) to (re-)associate&#13;
+    if(current${ParentPropertyName}!=null) {&#13;
+        current${ParentPropertyName}.clear${ChildPropertyNameInParent}();&#13;
+    }&#13;
 	${parentPropertyName}.modify${ChildPropertyNameInParent}(this);&#13;
 	// additional business logic&#13;
 	onModify${ParentPropertyName}(current${ParentPropertyName}, ${parentPropertyName});&#13;
 }&#13;
-public void clear${PropertyName}() {&#13;
+public void clear${ParentPropertyName}() {&#13;
     ${ParentPropertyType} current${ParentPropertyName} = get${ParentPropertyName}();&#13;
 	// check for no-op&#13;
 	if (current${ParentPropertyName} == null) {&#13;
@@ -373,4 +357,4 @@ public ${Type} unique${Type}Matching(fin
 // }}&#13;
 </template><template autoinsert="true" context="java-members" deleted="false" description="Object-level validation" enabled="true" name="isval">public String validate() {&#13;
     ${cursor}// TODO: return reason why object is in invalid state (and so cannot be saved/updated), or null if ok&#13;
-}</template></templates>
+}</template></templates>
\ No newline at end of file