openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: svn commit: r501955 - /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestPersistence.java
Date Wed, 31 Jan 2007 20:23:06 GMT
I seem to recall deciding to not use the SVN eclipse integration a few
months ago -- I do all my svn work from the command line. Maybe this was
why I made that decision.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Kevin Sutter [mailto:kwsutter@gmail.com] 
> Sent: Wednesday, January 31, 2007 11:40 AM
> To: open-jpa-commits@incubator.apache.org
> Subject: Re: svn commit: r501955 - 
> /incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/jav
a/org/apache/openjpa/persistence/simple/TestPersistence.java
> 
> Sorry about the "whole changed file" thing again.  I thought 
> I had found the
> problem with a doubly defined [miscellany] section in my svn 
> config file.
> But, I changed that and I still have the problem.  Like I 
> mentioned before,
> this only seems to happen after using the SVN Eclipse plugin 
> to do a merge
> of a patch.  Maybe I should just use the SVN command line to 
> do the commit?
> Or, maybe I have to manually do the Windows->Linux line 
> ending conversion
> before committing any changes?  Seems kind of error prone, 
> especially as my
> memory continues to grow older...  :-)
> 
> I looked back in our dev mailing list and Craig had performed 
> an operation
> on two of the OpenJPA sub-projects that supposedly helps with this
> situation.  Is this operation "permanent"?  That is, if I run 
> this on each
> sub-project and push the changes out, will that clean up this 
> line ending
> thing?  The problem with this approach is that it seems to 
> only work with
> existing files.  Any new files and we would have to remember 
> to run this
> operation again.
> 
> Any other ideas?  I would like to get this cleaned up so that 
> my commits
> look consistent with everybody else's.   When I do my diffs before
> committing, only the changed lines show up.  It's the commit 
> processing that
> picks up the whole file.
> 
> Thank you and, again, my apologies!
> Kevin
> 
> On 1/31/07, kwsutter@apache.org <kwsutter@apache.org> wrote:
> >
> > Author: kwsutter
> > Date: Wed Jan 31 11:27:11 2007
> > New Revision: 501955
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=501955
> > Log:
> > Simple test for OPENJPA-116.  Just modified the simple 
> TestPersistence
> > testcase with a new variation for testing the exception on 
> getDelegate()
> > when the EM is closed.
> >
> > Modified:
> >
> >     
> incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java
/org/apache/openjpa/persistence/simple/TestPersistence.java
> >
> > Modified:
> > 
> incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java
/org/apache/openjpa/persistence/simple/TestPersistence.java
> > URL:
> > 
> http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-p
ersistence->
jdbc/src/test/java/org/apache/openjpa/persistence/simple/TestP
> ersistence.java?view=diff&rev=501955&r1=501954&r2=501955
> >
> > 
> ==============================================================
> ================
> > ---
> > 
> incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java
/org/apache/openjpa/persistence/simple/TestPersistence.java
> > (original)
> > +++
> > 
> incubator/openjpa/trunk/openjpa-persistence-jdbc/src/test/java
/org/apache/openjpa/persistence/simple/TestPersistence.java
> > Wed Jan 31 11:27:11 2007
> > @@ -1,114 +1,134 @@
> > -/*
> > - * Copyright 2006 The Apache Software Foundation.
> > - *
> > - * Licensed 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.openjpa.persistence.simple;
> > -
> > -import java.util.HashMap;
> > -import java.util.Map;
> > -import javax.persistence.EntityManager;
> > -import javax.persistence.EntityManagerFactory;
> > -import javax.persistence.EntityTransaction;
> > -import javax.persistence.Persistence;
> > -
> > -import junit.framework.TestCase;
> > -import junit.textui.TestRunner;
> > -import org.apache.openjpa.persistence.OpenJPAEntityManager;
> > -
> > -/**
> > - * Simple test case to get an EntityManager and perform some basic
> > operations.
> > - *
> > - * @author Marc Prud'hommeaux
> > - */
> > -public class TestPersistence
> > -    extends TestCase {
> > -
> > -    private EntityManagerFactory emf;
> > -
> > -    public void setUp() {
> > -        Map props = new HashMap(System.getProperties());
> > -        props.put("openjpa.MetaDataFactory",
> > -            "jpa(Types=" + AllFieldTypes.class.getName() + ")");
> > -        emf = 
> Persistence.createEntityManagerFactory("test", props);
> > -    }
> > -
> > -    public void tearDown() {
> > -        if (emf == null)
> > -            return;
> > -        try {
> > -            EntityManager em = emf.createEntityManager();
> > -            em.getTransaction().begin();
> > -            em.createQuery("delete from 
> AllFieldTypes").executeUpdate();
> > -            em.getTransaction().commit();
> > -            em.close();
> > -            emf.close();
> > -        } catch (Exception e) {
> > -        }
> > -    }
> > -
> > -    public void testCreateEntityManager() {
> > -        EntityManager em = emf.createEntityManager();
> > -
> > -        EntityTransaction t = em.getTransaction();
> > -        assertNotNull(t);
> > -        t.begin();
> > -        t.setRollbackOnly();
> > -        t.rollback();
> > -
> > -        // openjpa-facade test
> > -        assertTrue(em instanceof OpenJPAEntityManager);
> > -        OpenJPAEntityManager ojem = (OpenJPAEntityManager) em;
> > -        ojem.getFetchPlan().setMaxFetchDepth(1);
> > -        assertEquals(1, ojem.getFetchPlan().getMaxFetchDepth());
> > -        em.close();
> > -    }
> > -
> > -    public void testPersist() {
> > -        EntityManager em = emf.createEntityManager();
> > -        em.getTransaction().begin();
> > -        em.persist(new AllFieldTypes());
> > -        em.getTransaction().commit();
> > -        em.close();
> > -    }
> > -
> > -    public void testQuery() {
> > -        EntityManager em = emf.createEntityManager();
> > -        em.getTransaction().begin();
> > -        AllFieldTypes aft = new AllFieldTypes();
> > -        aft.setStringField("foo");
> > -        aft.setIntField(10);
> > -        em.persist(aft);
> > -        em.getTransaction().commit();
> > -        em.close();
> > -
> > -        em = emf.createEntityManager();
> > -        em.getTransaction().begin();
> > -        assertEquals(1, em.createQuery
> > -            ("select x from AllFieldTypes x where x.stringField =
> > 'foo'").
> > -            getResultList().size());
> > -        assertEquals(0, em.createQuery
> > -            ("select x from AllFieldTypes x where x.stringField =
> > 'bar'").
> > -            getResultList().size());
> > -        assertEquals(1, em.createQuery
> > -            ("select x from AllFieldTypes x where 
> x.intField >= 10").
> > -            getResultList().size());
> > -        em.getTransaction().rollback();
> > -        em.close();
> > -    }
> > -
> > -    public static void main(String[] args) {
> > -        TestRunner.run(TestPersistence.class);
> > -    }
> > -}
> > -
> > +/*
> > + * Copyright 2006 The Apache Software Foundation.
> > + *
> > + * Licensed 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.openjpa.persistence.simple;
> > +
> > +import java.util.HashMap;
> > +import java.util.Map;
> > +import javax.persistence.EntityManager;
> > +import javax.persistence.EntityManagerFactory;
> > +import javax.persistence.EntityTransaction;
> > +import javax.persistence.Persistence;
> > +
> > +import junit.framework.TestCase;
> > +import junit.textui.TestRunner;
> > +import org.apache.openjpa.persistence.OpenJPAEntityManager;
> > +
> > +/**
> > + * Simple test case to get an EntityManager and perform some basic
> > operations.
> > + *
> > + * @author Marc Prud'hommeaux
> > + */
> > +public class TestPersistence
> > +    extends TestCase {
> > +
> > +    private EntityManagerFactory emf;
> > +
> > +    public void setUp() {
> > +        Map props = new HashMap(System.getProperties());
> > +        props.put("openjpa.MetaDataFactory",
> > +            "jpa(Types=" + AllFieldTypes.class.getName() + ")");
> > +        emf = 
> Persistence.createEntityManagerFactory("test", props);
> > +    }
> > +
> > +    public void tearDown() {
> > +        if (emf == null)
> > +            return;
> > +        try {
> > +            EntityManager em = emf.createEntityManager();
> > +            em.getTransaction().begin();
> > +            em.createQuery("delete from 
> AllFieldTypes").executeUpdate();
> > +            em.getTransaction().commit();
> > +            em.close();
> > +            emf.close();
> > +        } catch (Exception e) {
> > +        }
> > +    }
> > +
> > +    public void testCreateEntityManager() {
> > +        EntityManager em = emf.createEntityManager();
> > +
> > +        EntityTransaction t = em.getTransaction();
> > +        assertNotNull(t);
> > +        t.begin();
> > +        t.setRollbackOnly();
> > +        t.rollback();
> > +
> > +        // openjpa-facade test
> > +        assertTrue(em instanceof OpenJPAEntityManager);
> > +        OpenJPAEntityManager ojem = (OpenJPAEntityManager) em;
> > +        ojem.getFetchPlan().setMaxFetchDepth(1);
> > +        assertEquals(1, ojem.getFetchPlan().getMaxFetchDepth());
> > +        em.close();
> > +    }
> > +
> > +    public void testPersist() {
> > +        EntityManager em = emf.createEntityManager();
> > +        em.getTransaction().begin();
> > +        em.persist(new AllFieldTypes());
> > +        em.getTransaction().commit();
> > +        em.close();
> > +    }
> > +
> > +    public void testQuery() {
> > +        EntityManager em = emf.createEntityManager();
> > +        em.getTransaction().begin();
> > +        AllFieldTypes aft = new AllFieldTypes();
> > +        aft.setStringField("foo");
> > +        aft.setIntField(10);
> > +        em.persist(aft);
> > +        em.getTransaction().commit();
> > +        em.close();
> > +
> > +        em = emf.createEntityManager();
> > +        em.getTransaction().begin();
> > +        assertEquals(1, em.createQuery
> > +            ("select x from AllFieldTypes x where x.stringField =
> > 'foo'").
> > +            getResultList().size());
> > +        assertEquals(0, em.createQuery
> > +            ("select x from AllFieldTypes x where x.stringField =
> > 'bar'").
> > +            getResultList().size());
> > +        assertEquals(1, em.createQuery
> > +            ("select x from AllFieldTypes x where 
> x.intField >= 10").
> > +            getResultList().size());
> > +        em.getTransaction().rollback();
> > +        em.close();
> > +    }
> > +
> > +    /**
> > +     * Ensures that an IllegalStateException is thrown if 
> getDelegate is
> > called
> > +     * after closing the EntityManager.
> > +     */
> > +    public void testGetDelegateAfterClose() {
> > +        EntityManager em = emf.createEntityManager();
> > +
> > +        em.close();
> > +
> > +        try {
> > +            Object o = em.getDelegate();
> > +            fail();
> > +        }
> > +        catch(IllegalStateException ise) {
> > +            /*
> > +             * An IllegalStateException is expected. 
> Nothing to do here.
> > +             */
> > +        }
> > +    }
> > +
> > +    public static void main(String[] args) {
> > +        TestRunner.run(TestPersistence.class);
> > +    }
> > +}
> > +
> >
> >
> >
> 

Mime
View raw message