diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/old/contrib/persistence/common/src/test/java |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/old/contrib/persistence/common/src/test/java')
6 files changed, 179 insertions, 0 deletions
diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java new file mode 100644 index 0000000000..cd3a914ab9 --- /dev/null +++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.tuscany.service.persistence.common; + +import junit.framework.TestCase; + +public class DefaultPersistenceUnitBuilderTestCase extends TestCase { + + public void testNewEntityManagerFactory() { + new DefaultPersistenceUnitBuilder().newEntityManagerFactory("test", getClass().getClassLoader()); + } + +} diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java new file mode 100644 index 0000000000..bbbd32fa87 --- /dev/null +++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java @@ -0,0 +1,30 @@ +/* + * 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.tuscany.service.persistence.common; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Department { + + @Id + private Long id; + +} diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java new file mode 100644 index 0000000000..d90e3284eb --- /dev/null +++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java @@ -0,0 +1,30 @@ +/* + * 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.tuscany.service.persistence.common; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Employee { + + @Id + private Long id; + +} diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java new file mode 100644 index 0000000000..b8d7c53d4d --- /dev/null +++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java @@ -0,0 +1,32 @@ +/* + * 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.tuscany.service.persistence.common; + +import junit.framework.TestCase; + +public class PersistenceUnitScannerTestCase extends TestCase { + + public void testGetPersistenceUnitInfo() { + + new PersistenceUnitScanner().getPersistenceUnitInfo("test", getClass().getClassLoader()); + + + } + +} diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java new file mode 100644 index 0000000000..6b6fb7ad43 --- /dev/null +++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java @@ -0,0 +1,32 @@ +package org.apache.tuscany.service.persistence.common; + +import junit.framework.TestCase; + +public class PersistenceUnitTestCase extends TestCase { + + protected void setUp() throws Exception { +/* + addExtension("tuscany.jpa", getClass().getClassLoader().getResource("META-INF/sca/jpa.scdl")); + addExtension("geronimo.jta", getClass().getClassLoader().getResource("META-INF/sca/geronimo.jta.scdl")); + setApplicationSCDL(getClass().getClassLoader().getResource("META-INF/sca/test1.scdl")); + super.setUp(); + RuntimeComponent runtime = (RuntimeComponent) component.getParent().getParent(); + CompositeComponent systemComposite = runtime.getSystemComponent(); + CompositeComponent topLevelComposite = (CompositeComponent) systemComposite.getSystemChild(TUSCANY_SYSTEM); + + JavaAtomicComponent cmp = (JavaAtomicComponent) component.getChild("TestService1"); + TestService1 testService1 = (TestService1) cmp.getTargetInstance(); + testService1.testMethod(); +*/ + } + + protected void tearDown() throws Exception { +/* + super.tearDown(); +*/ + } + + public void testGetComponent() { + } + +} diff --git a/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java new file mode 100644 index 0000000000..74052984b9 --- /dev/null +++ b/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java @@ -0,0 +1,26 @@ +package org.apache.tuscany.service.persistence.common; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import javax.transaction.TransactionManager; + +import org.apache.tuscany.api.annotation.Resource; + +public class TestService1 { + + @Resource + protected TransactionManager tx; + + @PersistenceUnit(unitName = "test") + protected EntityManagerFactory emf; + + public void testMethod() throws Exception { + + tx.begin(); + EntityManager em = emf.createEntityManager(); + tx.commit(); + + } + +} |