PageRenderTime 28ms CodeModel.GetById 18ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/com/google/appengine/datanucleus/jdo/JDODataSourceConfigTest.java

http://datanucleus-appengine.googlecode.com/
Java | 54 lines | 26 code | 10 blank | 18 comment | 0 complexity | e096dc8447bd4b849c0329f38e09edfc MD5 | raw file
 1/**********************************************************************
 2Copyright (c) 2009 Google Inc.
 3
 4Licensed under the Apache License, Version 2.0 (the "License");
 5you may not use this file except in compliance with the License.
 6You may obtain a copy of the License at
 7
 8http://www.apache.org/licenses/LICENSE-2.0
 9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15**********************************************************************/
16package com.google.appengine.datanucleus.jdo;
17
18import junit.framework.TestCase;
19
20import org.datanucleus.api.jdo.JDOPersistenceManager;
21import org.datanucleus.api.jdo.JDOPersistenceManagerFactory;
22
23import com.google.appengine.datanucleus.DatastoreManager;
24
25import javax.jdo.JDOHelper;
26
27/**
28 * @author Max Ross <maxr@google.com>
29 */
30public class JDODataSourceConfigTest extends TestCase {
31
32  public void testTransactionalPMF() {
33    JDOPersistenceManagerFactory pmf =
34        (JDOPersistenceManagerFactory) JDOHelper.getPersistenceManagerFactory("transactional");
35    DatastoreManager storeMgr = (DatastoreManager) pmf.getNucleusContext().getStoreManager();
36    JDOPersistenceManager pm = (JDOPersistenceManager) pmf.getPersistenceManager();
37    assertTrue(storeMgr.connectionFactoryIsAutoCreateTransaction());
38    pm.close();
39    pmf.close();
40  }
41
42  public void testNonTransactionalPMF() {
43    JDOPersistenceManagerFactory pmf =
44        (JDOPersistenceManagerFactory) JDOHelper.getPersistenceManagerFactory("nontransactional");
45    DatastoreManager storeMgr = (DatastoreManager) pmf.getNucleusContext().getStoreManager();
46    JDOPersistenceManager pm = (JDOPersistenceManager) pmf.getPersistenceManager();
47    assertFalse(storeMgr.connectionFactoryIsAutoCreateTransaction());
48    pm.close();
49    pmf.close();
50  }
51
52  
53
54}