summaryrefslogtreecommitdiffstats
path: root/sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common')
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/DefaultPersistenceUnitBuilderTestCase.java29
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Department.java30
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/Employee.java30
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitScannerTestCase.java32
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/PersistenceUnitTestCase.java32
-rw-r--r--sandbox/old/contrib/persistence/common/src/test/java/org/apache/tuscany/service/persistence/common/TestService1.java26
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();
+
+ }
+
+}