On 9 July 2015 at 08:47, Stephen Cameron <[email protected]> wrote:

> the simple one Date property does have the same problem in Wicket viewer.
>
> I check this into Github:
>
> https://github.com/Stephen-Cameron-Data-Services/isis-chats/blob/master/dom/src/main/java/au/com/scds/chats/dom/modules/participant/DateTest.java
>
>
ok, great.  Well, not great, I guess I need to look into it.  But thanks
for taking the time to isolate a test case for us.




> There is an action in Participant to trigger the error
>
>     @MemberOrder(sequence = "200")
>     @Action(semantics = SemanticsOf.IDEMPOTENT)
>     @ActionLayout(named = "Date Test")
>     public DateTest updateDateTest() {
>         DateTest t = container.newTransientInstance(DateTest.class);
>         this.test = t;
>         container.persist(t);
>         return this.test;
>     }
>
> If I use DateTest class independently of Wicket viewer it works fine, but I
> have not tried to round trip to a database with it. How can I write a JUnit
> test to do that independently of the viewer? I need to start writing such
> tests, so now is a good time to learn.
>
>
>
The simpleapp archetype [1] has the integtest project which shows the
scaffolding.  There's  also a chapter on the topic in our spiffy new users
guide [2]

Cheers
Dan

[1] http://isis.apache.org/simpleapp-archetype.html
[2] http://isis.apache.org/guides/ug.html#_ug_testing




>
>
>
> On Thu, Jul 9, 2015 at 4:45 PM, Stephen Cameron <
> [email protected]>
> wrote:
>
> > changing it to java.util.Date and rebuilding fixes the problem, then
> going
> > back to o.a.i.applib.Date breaks it again.
> >
> > I am using Eclipse too!
> >
> > For interest I'll try a class with just one date field and see what
> > happens.
> >
> > Then I'll try the Joda library instead.
> >
> >
> >
> > On Thu, Jul 9, 2015 at 2:51 PM, Dan Haywood <
> [email protected]>
> > wrote:
> >
> >> I'm not completely sure the issue is from using o.a.i.applib.value.Date
> >> (though in any case you probably should be using one of the Joda date
> >> classes instead).
> >>
> >> Rather, when I've seen this DN issue it's because it has attempted -
> >> through a race condition or for some other hard-to-replicate reason - to
> >> re-enhance an already enhanced class, or at any rate the enhancement is
> >> out-of-whack with the actual fields of the class.
> >>
> >> I've only ever hit this issue when using Eclipse and relying on the DN
> >> plugin's automatic enhancement.  I've never had the issue when using
> >> IntelliJ, or from the command line.
> >>
> >> When the issue went away by you moving away from o.a.i.applib.value.Date
> >> to
> >> something else, it was probably nothing more than the code got
> recompiled
> >> and then re-enhanced correctly.  Try reverting back to
> >> o.a.i.applib.value.Date and it'll probably still work.  (If it doesn't,
> >> then that'll be a useful test case for us to work from!)
> >>
> >> Thx
> >> Dan
> >>
> >>
> >>
> >>
> >>
> >>
> >> On 9 July 2015 at 05:45, Stephen Cameron <[email protected]>
> >> wrote:
> >>
> >> > Reason was me trying to use:
> >> > org.apache.isis.applib.value.Date
> >> >
> >> > ---------- Forwarded message ----------
> >> > From: Stephen Cameron <[email protected]>
> >> > Date: Thu, Jul 9, 2015 at 1:32 PM
> >> > Subject: java.lang.IllegalArgumentException: out of field index :15
> >> > To: [email protected]
> >> >
> >> >
> >> > Hi,
> >> >
> >> > I have a DataNucleus error, with a not very informative message!
> >> >
> >> >
> >> >
> >> > Caused by: java.lang.IllegalArgumentException: out of field index :15
> >> >     at
> >> >
> >> >
> >>
> au.com.scds.chats.dom.modules.participant.SocialFactors.jdoCopyField(SocialFactors.java)
> >> >     at
> >> >
> >> >
> >>
> au.com.scds.chats.dom.modules.participant.SocialFactors.jdoCopyFields(SocialFactors.java)
> >> >     at
> >> >
> >>
> org.datanucleus.state.JDOStateManager.saveFields(JDOStateManager.java:694)
> >> >     at
> >> >
> >> >
> >>
> org.datanucleus.state.JDOStateManager.initialiseForPersistentNew(JDOStateManager.java:437)
> >> >
> >> >
> >> >
> >> > Class is presently:
> >> >
> >> > package au.com.scds.chats.dom.modules.participant;
> >> >
> >> > import javax.jdo.annotations.Column;
> >> > import javax.jdo.annotations.IdentityType;
> >> > import javax.jdo.annotations.VersionStrategy;
> >> >
> >> > import org.apache.isis.applib.DomainObjectContainer;
> >> > import org.apache.isis.applib.annotation.BookmarkPolicy;
> >> > import org.apache.isis.applib.annotation.DomainObject;
> >> > import org.apache.isis.applib.annotation.DomainObjectLayout;
> >> > import org.apache.isis.applib.annotation.MemberOrder;
> >> > import org.apache.isis.applib.annotation.Property;
> >> > import org.apache.isis.applib.annotation.Where;
> >> > import org.apache.isis.applib.value.Date;
> >> >
> >> > @javax.jdo.annotations.PersistenceCapable(identityType =
> >> > IdentityType.DATASTORE)
> >> > @javax.jdo.annotations.DatastoreIdentity(strategy =
> >> > javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column = "id")
> >> > @javax.jdo.annotations.Version(strategy =
> >> VersionStrategy.VERSION_NUMBER,
> >> > column = "version")
> >> > @DomainObject(objectType = "SOCIAL-FACTORS")
> >> > @DomainObjectLayout(bookmarking = BookmarkPolicy.AS_ROOT)
> >> > public class SocialFactors {
> >> >
> >> >     public String title() {
> >> >         return "Social Factors of Participant: " +
> parent.getFullname();
> >> >     }
> >> >
> >> >     // {{ ParentParticipant (property)
> >> >     private Participant parent;
> >> >
> >> >     @Column(allowsNull = "false")
> >> >     @Property(hidden = Where.EVERYWHERE)
> >> >     public Participant getParentParticipant() {
> >> >         return parent;
> >> >     }
> >> >
> >> >     public void setParentParticipant(final Participant parent) {
> >> >         if (this.parent == null && parent != null)
> >> >             this.parent = parent;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ LimitingHealthIssues (property)
> >> >     private String limitingHealthIssues;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "1")
> >> >     public String getLimitingHealthIssues() {
> >> >         return limitingHealthIssues;
> >> >     }
> >> >
> >> >     public void setLimitingHealthIssues(final String
> >> limitingHealthIssues)
> >> > {
> >> >         this.limitingHealthIssues = limitingHealthIssues;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ OtherLimitingFactors (property)
> >> >     private String otherLimitingFactors;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "2")
> >> >     public String getOtherLimitingFactors() {
> >> >         return otherLimitingFactors;
> >> >     }
> >> >
> >> >     public void setOtherLimitingFactors(final String
> >> otherLimitingFactors)
> >> > {
> >> >         this.otherLimitingFactors = otherLimitingFactors;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ DriversLicence (property)
> >> >     private String driversLicence;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "3")
> >> >     public String getDriversLicence() {
> >> >         return driversLicence;
> >> >     }
> >> >
> >> >     public void setDriversLicence(final String driversLicence) {
> >> >         this.driversLicence = driversLicence;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ DrivingAbility (property)
> >> >     private String drivingAbility;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "4")
> >> >     public String getDrivingAbility() {
> >> >         return drivingAbility;
> >> >     }
> >> >
> >> >     public void setDrivingAbility(final String drivingAbility) {
> >> >         this.drivingAbility = drivingAbility;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ DrivingConfidence (property)
> >> >     private String drivingConfidence;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "5")
> >> >     public String getDrivingConfidence() {
> >> >         return drivingConfidence;
> >> >     }
> >> >
> >> >     public void setDrivingConfidence(final String drivingConfidence) {
> >> >         this.drivingConfidence = drivingConfidence;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ PlaceOfOrigin (property)
> >> >     private String placeOfOrigin;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "6")
> >> >     public String getPlaceOfOrigin() {
> >> >         return placeOfOrigin;
> >> >     }
> >> >
> >> >     public void setPlaceOfOrigin(final String placeOfOrigin) {
> >> >         this.placeOfOrigin = placeOfOrigin;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ DateofSettlement (property)
> >> >     private Date dateOfSettlement;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "7")
> >> >     public Date getDateofSettlement() {
> >> >         return dateOfSettlement;
> >> >     }
> >> >
> >> >     public void setDateofSettlement(final Date dateOfSettlement) {
> >> >         this.dateOfSettlement = dateOfSettlement;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ closeRelatives (property)
> >> >     private String closeRelatives;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "8")
> >> >     public String getCloseRelatives() {
> >> >         return closeRelatives;
> >> >     }
> >> >
> >> >     public void setCloseRelatives(final String closeRelatives) {
> >> >         this.closeRelatives = closeRelatives;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ closeRelativeAndFriendCount (property)
> >> >     private Integer closeRelativeAndFriendCount;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "9")
> >> >     public Integer getCloseRelativeAndFriendCount() {
> >> >         return closeRelativeAndFriendCount;
> >> >     }
> >> >
> >> >     public void setCloseRelativeAndFriendCount(
> >> >             final Integer closeRelativeAndFriendCount) {
> >> >         this.closeRelativeAndFriendCount =
> closeRelativeAndFriendCount;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ ProximityOfRelatives (property)
> >> >     private String proximityOfRelatives;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "10")
> >> >     public String getProximityOfRelatives() {
> >> >         return proximityOfRelatives;
> >> >     }
> >> >
> >> >     public void setProximityOfRelatives(final String
> >> proximityOfRelatives)
> >> > {
> >> >         this.proximityOfRelatives = proximityOfRelatives;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ ProximityOfFriends (property)
> >> >     private String proximityOfFriends;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "11")
> >> >     public String getProximityOfFriends() {
> >> >         return proximityOfFriends;
> >> >     }
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     public void setProximityOfFriends(final String
> proximityOfFriends) {
> >> >         this.proximityOfFriends = proximityOfFriends;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ InvolvementInGroupsClubs (property)
> >> >     private String involvementInGroupsClubs;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "12")
> >> >     public String getInvolvementInGroupsClubs() {
> >> >         return involvementInGroupsClubs;
> >> >     }
> >> >
> >> >     public void setInvolvementInGroupsClubs(final String involvement)
> {
> >> >         this.involvementInGroupsClubs = involvement;
> >> >     }
> >> >
> >> >     // }}
> >> >
> >> >     // {{ involvementInInterestsHobbies (property)
> >> >     private String involvementInInterestsHobbies;
> >> >
> >> >     @Column(allowsNull = "true")
> >> >     @MemberOrder(sequence = "13")
> >> >     public String getInvolvementInInterestsHobbies() {
> >> >         return involvementInInterestsHobbies;
> >> >     }
> >> >
> >> >     public void setInvolvementInInterestsHobbies(
> >> >             final String involvmentInInterestsHobbies) {
> >> >         this.involvementInInterestsHobbies =
> >> involvmentInInterestsHobbies;
> >> >     } // }}
> >> >
> >> >     // {{ injected dependencies
> >> >     @javax.inject.Inject
> >> >     @SuppressWarnings("unused")
> >> >     private DomainObjectContainer container;
> >> >     // }}
> >> >
> >> > }
> >> >
> >>
> >
> >
>

Reply via email to