You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2008/09/16 17:34:53 UTC
svn commit: r695943 - in /labs/magma/trunk/database-junit-pack: ./ src/
src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/magma/ src/main/java/org/apache/magma/database/
src/main/java/org/apache/magma/databa...
Author: simoneg
Date: Tue Sep 16 08:34:50 2008
New Revision: 695943
URL: http://svn.apache.org/viewvc?rev=695943&view=rev
Log:
Initial import.
Added:
labs/magma/trunk/database-junit-pack/pom.xml
labs/magma/trunk/database-junit-pack/src/
labs/magma/trunk/database-junit-pack/src/main/
labs/magma/trunk/database-junit-pack/src/main/java/
labs/magma/trunk/database-junit-pack/src/main/java/org/
labs/magma/trunk/database-junit-pack/src/main/java/org/apache/
labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/
labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/database/
labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/database/junitpack/
labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/database/junitpack/RollbackAfterTeardown.aj
labs/magma/trunk/database-junit-pack/src/main/resources/
labs/magma/trunk/database-junit-pack/src/main/resources/META-INF/
labs/magma/trunk/database-junit-pack/src/main/resources/META-INF/magma.test.default.properties
labs/magma/trunk/database-junit-pack/src/test/
labs/magma/trunk/database-junit-pack/src/test/java/
labs/magma/trunk/database-junit-pack/src/test/java/org/
labs/magma/trunk/database-junit-pack/src/test/java/org/apache/
labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/
labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/
labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/
labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/Bean.java
labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/TestingTheTest.java
Added: labs/magma/trunk/database-junit-pack/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/trunk/database-junit-pack/pom.xml?rev=695943&view=auto
==============================================================================
--- labs/magma/trunk/database-junit-pack/pom.xml (added)
+++ labs/magma/trunk/database-junit-pack/pom.xml Tue Sep 16 08:34:50 2008
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <artifactId>magma-parent</artifactId>
+ <groupId>org.apache.magma</groupId>
+ <version>1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>database-junit-pack</artifactId>
+ <name>Database Junit Pack</name>
+ <version>0.0.1-SNAPSHOT</version>
+ <description>Offers an OpenJPA and Hypersonic DB condifured to execute Junit tests on beans using database.</description>
+ <packaging>magma</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.magma.tools</groupId>
+ <artifactId>maven-magma-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>database-openjpa</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-database</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>tools-complete-tracing</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency-->
+ </dependencies>
+</project>
Added: labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/database/junitpack/RollbackAfterTeardown.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/database/junitpack/RollbackAfterTeardown.aj?rev=695943&view=auto
==============================================================================
--- labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/database/junitpack/RollbackAfterTeardown.aj (added)
+++ labs/magma/trunk/database-junit-pack/src/main/java/org/apache/magma/database/junitpack/RollbackAfterTeardown.aj Tue Sep 16 08:34:50 2008
@@ -0,0 +1,43 @@
+/*
+ * 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.magma.database.junitpack;
+
+import org.apache.magma.database.openjpa.JPADatabase;
+import org.apache.magma.database.openjpa.JPADatabasesRegistry;
+
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+public aspect RollbackAfterTeardown {
+
+ pointcut tearDown() : execution(* TestCase.tearDown());
+
+
+ after() : tearDown() {
+ Set<JPADatabase> dbs = JPADatabasesRegistry.get();
+ if (dbs == null) return;
+ for (JPADatabase db : dbs) {
+ try {
+ db.rollback();
+ } finally {
+ JPADatabasesRegistry.remove(db);
+ }
+ }
+ }
+
+}
Added: labs/magma/trunk/database-junit-pack/src/main/resources/META-INF/magma.test.default.properties
URL: http://svn.apache.org/viewvc/labs/magma/trunk/database-junit-pack/src/main/resources/META-INF/magma.test.default.properties?rev=695943&view=auto
==============================================================================
--- labs/magma/trunk/database-junit-pack/src/main/resources/META-INF/magma.test.default.properties (added)
+++ labs/magma/trunk/database-junit-pack/src/main/resources/META-INF/magma.test.default.properties Tue Sep 16 08:34:50 2008
@@ -0,0 +1,20 @@
+#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.
+openjpa.ConnectionURL=jdbc:hsqldb:mem:junitdb;create=true
+openjpa.ConnectionUserName=sa
+openjpa.ConnectionDriverName=org.hsqldb.jdbcDriver
+openjpa.ConnectionPassword=
+openjpa.jdbc.SynchronizeMappings=buildSchema(ForeignKeys=true)
+openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
Added: labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/Bean.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/Bean.java?rev=695943&view=auto
==============================================================================
--- labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/Bean.java (added)
+++ labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/Bean.java Tue Sep 16 08:34:50 2008
@@ -0,0 +1,51 @@
+/*
+ * 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.magma.database.junitpack;
+
+import org.apache.magma.beans.MagmaBean;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+@MagmaBean
+public class Bean {
+
+ private long id;
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Id
+ @GeneratedValue
+ public long getId() {
+ return id;
+ }
+
+ protected void setId(long id) {
+ this.id = id;
+ }
+
+}
Added: labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/TestingTheTest.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/TestingTheTest.java?rev=695943&view=auto
==============================================================================
--- labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/TestingTheTest.java (added)
+++ labs/magma/trunk/database-junit-pack/src/test/java/org/apache/magma/database/junitpack/TestingTheTest.java Tue Sep 16 08:34:50 2008
@@ -0,0 +1,44 @@
+/*
+ * 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.magma.database.junitpack;
+
+import org.apache.magma.database.Database;
+import org.apache.magma.database.openjpa.JPADatabase;
+
+import org.junit.Test;
+import static junit.framework.Assert.*;
+
+
+public class TestingTheTest {
+
+ @Test
+ public void simpleDatabaseExistence() throws Exception {
+ Database db = new Database();
+ assertNotNull(db);
+ assertEquals(JPADatabase.class, db.getClass());
+ }
+
+ @Test
+ public void doSomething() throws Exception {
+ System.out.println(org.apache.magma.settings.Settings.getAll());
+ Database db = new Database();
+ Bean b = new Bean();
+ b.setName("Test1");
+ db.save(b);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org