Updated Branches: refs/heads/master 4f2d9a582 -> 0c3c2bb76
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimplisticEntityManagerResolver.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimplisticEntityManagerResolver.java b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimplisticEntityManagerResolver.java new file mode 100644 index 0000000..14f6511 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimplisticEntityManagerResolver.java @@ -0,0 +1,37 @@ +/* + * 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.deltaspike.data.test.service; + +import javax.inject.Inject; +import javax.persistence.EntityManager; + +import org.apache.deltaspike.data.api.EntityManagerResolver; + +public class SimplisticEntityManagerResolver implements EntityManagerResolver +{ + + @Inject @Simplistic + private EntityManager entityManager; + + @Override + public EntityManager resolveEntityManager() + { + return entityManager; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/Statistics.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/Statistics.java b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/Statistics.java new file mode 100644 index 0000000..a423d48 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/Statistics.java @@ -0,0 +1,53 @@ +/* + * 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.deltaspike.data.test.service; + +public class Statistics +{ + + private final Double average; + private final Long count; + + public Statistics(Double average, Long count) + { + this.average = average; + this.count = count; + } + + @Override + public String toString() + { + StringBuilder builder = new StringBuilder(); + builder.append("Statistics [") + .append("average=").append(average) + .append(", count=").append(count) + .append("]"); + return builder.toString(); + } + + public Double getAverage() + { + return average; + } + + public Long getCount() + { + return count; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/Logging.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/Logging.java b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/Logging.java new file mode 100755 index 0000000..ec5170c --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/Logging.java @@ -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.deltaspike.data.test.util; + +import java.io.InputStream; +import java.util.logging.LogManager; + +public class Logging +{ + + private Logging() + { + } + + public static void reconfigure() + { + try + { + InputStream loggingProperties = Logging.class.getClassLoader().getResourceAsStream("logging.properties"); + LogManager.getLogManager().readConfiguration(loggingProperties); + } + catch (Exception e) + { + throw new RuntimeException("Failed to reconfigure Java Logging.", e); + } + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java new file mode 100755 index 0000000..2eccc3f --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/util/TestDeployments.java @@ -0,0 +1,137 @@ +/* + * 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.deltaspike.data.test.util; + +import org.apache.deltaspike.data.api.AbstractEntityRepository; +import org.apache.deltaspike.data.api.EntityManagerConfig; +import org.apache.deltaspike.data.api.EntityManagerResolver; +import org.apache.deltaspike.data.api.EntityRepository; +import org.apache.deltaspike.data.api.FirstResult; +import org.apache.deltaspike.data.api.MaxResults; +import org.apache.deltaspike.data.api.Modifying; +import org.apache.deltaspike.data.api.Query; +import org.apache.deltaspike.data.api.QueryParam; +import org.apache.deltaspike.data.api.QueryResult; +import org.apache.deltaspike.data.api.Repository; +import org.apache.deltaspike.data.api.audit.CreatedOn; +import org.apache.deltaspike.data.api.audit.CurrentUser; +import org.apache.deltaspike.data.api.audit.ModifiedBy; +import org.apache.deltaspike.data.api.audit.ModifiedOn; +import org.apache.deltaspike.data.api.criteria.Criteria; +import org.apache.deltaspike.data.api.criteria.CriteriaSupport; +import org.apache.deltaspike.data.api.criteria.QuerySelection; +import org.apache.deltaspike.data.impl.RepositoryDefinitionException; +import org.apache.deltaspike.data.impl.RepositoryExtension; +import org.apache.deltaspike.data.impl.audit.AuditEntityListener; +import org.apache.deltaspike.data.impl.builder.QueryBuilder; +import org.apache.deltaspike.data.impl.criteria.QueryCriteria; +import org.apache.deltaspike.data.impl.handler.QueryHandler; +import org.apache.deltaspike.data.impl.meta.RepositoryComponents; +import org.apache.deltaspike.data.impl.param.Parameters; +import org.apache.deltaspike.data.impl.property.Property; +import org.apache.deltaspike.data.impl.util.EntityUtils; +import org.apache.deltaspike.data.spi.DelegateQueryHandler; +import org.apache.deltaspike.data.spi.QueryInvocationContext; +import org.apache.deltaspike.data.test.TransactionalTestCase; +import org.apache.deltaspike.data.test.domain.AuditedEntity; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ArchivePath; +import org.jboss.shrinkwrap.api.ArchivePaths; +import org.jboss.shrinkwrap.api.Filter; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.jboss.shrinkwrap.impl.base.filter.ExcludeRegExpPaths; +import org.jboss.shrinkwrap.resolver.api.maven.Maven; + +public abstract class TestDeployments +{ + + public static Filter<ArchivePath> TEST_FILTER = new ExcludeRegExpPaths(".*Test.*class"); + + public static WebArchive initDeployment() + { + return initDeployment(".*test.*"); + } + + /** + * Create a basic deployment containing API classes, the Extension class and test persistence / beans descriptor. + * + * @return Basic web archive. + */ + public static WebArchive initDeployment(String testFilter) + { + Logging.reconfigure(); + WebArchive archive = ShrinkWrap + .create(WebArchive.class, "test.war") + .addAsLibrary(createApiArchive()) + .addClasses(RepositoryExtension.class, RepositoryDefinitionException.class) + .addClasses(TransactionalTestCase.class) + .addPackages(true, TEST_FILTER, createImplPackages()) + .addPackages(true, AuditedEntity.class.getPackage()) + .addPackages(true, new ExcludeRegExpPaths(testFilter), TransactionalTestCase.class.getPackage()) + .addAsWebInfResource("test-persistence.xml", + ArchivePaths.create("classes/META-INF/persistence.xml")) + .addAsWebInfResource("META-INF/services/javax.enterprise.inject.spi.Extension", + ArchivePaths.create("classes/META-INF/services/javax.enterprise.inject.spi.Extension")) + .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); + + return addDependencies(archive); + } + + public static Package[] createImplPackages() + { + return new Package[] { + AuditEntityListener.class.getPackage(), + QueryBuilder.class.getPackage(), + QueryCriteria.class.getPackage(), + QueryHandler.class.getPackage(), + RepositoryComponents.class.getPackage(), + Parameters.class.getPackage(), + EntityUtils.class.getPackage(), + Property.class.getPackage() + }; + } + + public static Archive<?> createApiArchive() + { + return ShrinkWrap.create(JavaArchive.class, "archive.jar") + .addClasses(AbstractEntityRepository.class, Repository.class, EntityRepository.class, + FirstResult.class, MaxResults.class, Modifying.class, + Query.class, QueryParam.class, QueryResult.class, + EntityManagerConfig.class, EntityManagerResolver.class) + .addClasses(Criteria.class, QuerySelection.class, CriteriaSupport.class) + .addClasses(CreatedOn.class, CurrentUser.class, ModifiedBy.class, ModifiedOn.class) + .addClasses(DelegateQueryHandler.class, QueryInvocationContext.class); + } + + public static WebArchive addDependencies(WebArchive archive) + { + return archive.addAsLibraries( + Maven.resolver().loadPomFromFile("pom.xml").resolve( + "org.apache.deltaspike.core:deltaspike-core-api", + "org.apache.deltaspike.core:deltaspike-core-impl", + "org.apache.deltaspike.modules:deltaspike-partial-bean-module-api", + "org.apache.deltaspike.modules:deltaspike-partial-bean-module-impl") + .withTransitivity() + .asFile()); + } + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources-glassfish/test-mapped-persistence.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources-glassfish/test-mapped-persistence.xml b/deltaspike/modules/data/impl/src/test/resources-glassfish/test-mapped-persistence.xml new file mode 100644 index 0000000..5ad9393 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources-glassfish/test-mapped-persistence.xml @@ -0,0 +1,32 @@ +<?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. +--> +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + <persistence-unit name="test"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + <jta-data-source>jdbc/__default</jta-data-source> + <mapping-file>META-INF/orm.xml</mapping-file> + <mapping-file>META-INF/custom-orm.xml</mapping-file> + <properties> + <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> + <property name="eclipselink.logging.level" value="FINE"/> + <property name="eclipselink.logging.parameters" value="true" /> + </properties> + </persistence-unit> +</persistence> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources-glassfish/test-persistence.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources-glassfish/test-persistence.xml b/deltaspike/modules/data/impl/src/test/resources-glassfish/test-persistence.xml new file mode 100644 index 0000000..f615141 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources-glassfish/test-persistence.xml @@ -0,0 +1,30 @@ +<?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. +--> +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + <persistence-unit name="test"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + <jta-data-source>jdbc/__default</jta-data-source> + <properties> + <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> + <property name="eclipselink.logging.level" value="FINE"/> + <property name="eclipselink.logging.parameters" value="true" /> + </properties> + </persistence-unit> +</persistence> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-mapped-persistence.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-mapped-persistence.xml b/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-mapped-persistence.xml new file mode 100644 index 0000000..e26ed84 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-mapped-persistence.xml @@ -0,0 +1,29 @@ +<?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. +--> +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + <persistence-unit name="test"> + <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> + <mapping-file>META-INF/orm.xml</mapping-file> + <mapping-file>META-INF/custom-orm.xml</mapping-file> + <properties> + <property name="hibernate.hbm2ddl.auto" value="create-drop"/> + </properties> + </persistence-unit> +</persistence> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-persistence.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-persistence.xml b/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-persistence.xml new file mode 100644 index 0000000..bd3f4a5 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources-jbossas7/test-persistence.xml @@ -0,0 +1,27 @@ +<?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. +--> +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + <persistence-unit name="test"> + <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> + <properties> + <property name="hibernate.hbm2ddl.auto" value="create-drop"/> + </properties> + </persistence-unit> +</persistence> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources-openejb/test-mapped-persistence.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources-openejb/test-mapped-persistence.xml b/deltaspike/modules/data/impl/src/test/resources-openejb/test-mapped-persistence.xml new file mode 100644 index 0000000..1559d30 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources-openejb/test-mapped-persistence.xml @@ -0,0 +1,32 @@ +<?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. +--> +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + <persistence-unit name="test"> + <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> + <jta-data-source>testDatabase</jta-data-source> + <mapping-file>META-INF/orm.xml</mapping-file> + <mapping-file>META-INF/custom-orm.xml</mapping-file> + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + <property name="openjpa.Log" value="DefaultLevel=WARN, SQL=TRACE"/> + <property name="openjpa.jdbc.DBDictionary" value="hsql(SimulateLocking=true)"/> + </properties> + </persistence-unit> +</persistence> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources-openejb/test-persistence.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources-openejb/test-persistence.xml b/deltaspike/modules/data/impl/src/test/resources-openejb/test-persistence.xml new file mode 100644 index 0000000..c57b3f1 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources-openejb/test-persistence.xml @@ -0,0 +1,31 @@ +<?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. +--> +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> + <persistence-unit name="test"> + <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> + <jta-data-source>testDatabase</jta-data-source> + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + <property name="openjpa.Log" value="DefaultLevel=WARN, SQL=TRACE"/> + <property name="openjpa.jdbc.DBDictionary" value="hsql(SimulateLocking=true)"/> + <property name="openejb.jpa.init-entitymanager" value="true" /> + </properties> + </persistence-unit> +</persistence> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources/arquillian.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources/arquillian.xml b/deltaspike/modules/data/impl/src/test/resources/arquillian.xml new file mode 100644 index 0000000..3d1fdc0 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources/arquillian.xml @@ -0,0 +1,96 @@ +<!-- + 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. +--> + +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> + + <!--Uncomment to have test archives exported to the file system for inspection --> + <!-- + <engine> + <property name="deploymentExportPath">target/</property> + </engine> + --> + + <defaultProtocol type="Servlet 3.0" /> + + <container qualifier="jbossas-managed-7"> + <configuration> + <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m -Djboss.socket.binding.port-offset=10000</property> + <property name="managementPort">19999</property> + <property name="outputToConsole">false</property> + <property name="allowConnectingToRunningServer">true</property> + </configuration> + </container> + + <container qualifier="jbossas-build-managed-7"> + <configuration> + <property name="jbossHome">target/jboss-as-7.1.1.Final</property> + <property name="managementPort">19999</property> + <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m -Djboss.socket.binding.port-offset=10000</property> + <property name="outputToConsole">false</property> + <property name="allowConnectingToRunningServer">true</property> + </configuration> + </container> + + <container qualifier="jbossas-remote-7"> + <!-- + for remote debugging enable "remote socket debugging" - uncomment: + set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" + in + standalone.conf (standalone.conf.bat) + and connect to + port 8787 + --> + </container> + + <!-- don't remove the qualifier - it's needed for the arquillian.launch property --> + <container qualifier="glassfish-remote-3.1"> + </container> + + <container qualifier="wls-remote-12c"> + <configuration> + <property name="adminUrl">t3://localhost:7001</property> + <property name="adminUserName">weblogic1</property> + <property name="adminPassword">weblogic1</property> + <property name="target">AdminServer</property> + <property name="wlsHome">${WLS_HOME}</property> + </configuration> + </container> + + <container qualifier="tomee"> + <configuration> + <!-- tomee gets copied to this directory during the build --> + <property name="dir">target/tomee</property> + + <!-- value '-1' to allow arquillian-tomee-remote to use dynamic settings --> + <property name="httpPort">-1</property> + <property name="ajpPort">-1</property> + <property name="stopPort">-1</property> + <property name="dir">target/apache-tomee-remote</property> + <property name="appWorkingDir">target/arquillian-test-working-dir</property> + <property name="properties"> + testDatabase = new://Resource?type=DataSource + testDatabase.JdbcDriver = org.hsqldb.jdbcDriver + testDatabase.JdbcUrl = jdbc:hsqldb:mem:testdb + testDatabase.JtaManaged = true + </property> + </configuration> + </container> + +</arquillian> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources/log4j.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources/log4j.xml b/deltaspike/modules/data/impl/src/test/resources/log4j.xml new file mode 100755 index 0000000..aa3599d --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources/log4j.xml @@ -0,0 +1,59 @@ +<?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. +--> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" + debug="false"> + + <!-- ============================== --> + <!-- Append messages to the console --> + <!-- ============================== --> + + <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> + <param name="Target" value="System.out" /> + <param name="Threshold" value="DEBUG" /> + + <layout class="org.apache.log4j.PatternLayout"> + <!-- The default pattern: Date Priority [Category] Message\n --> + <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n" /> + </layout> + </appender> + + <!-- ================ --> + <!-- Limit categories --> + <!-- ================ --> + + <category name="org.apache.deltaspike.data"> + <priority value="DEBUG" /> + </category> + + <category name="org.glassfish"> + <priority value="ERROR" /> + </category> + + <!-- ======================= --> + <!-- Setup the Root category --> + <!-- ======================= --> + + <root> + <appender-ref ref="CONSOLE" /> + </root> + +</log4j:configuration> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources/logging.properties ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources/logging.properties b/deltaspike/modules/data/impl/src/test/resources/logging.properties new file mode 100755 index 0000000..9a4f080 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources/logging.properties @@ -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. +##################################################################################### + +handlers=java.util.logging.ConsoleHandler +.level=SEVERE + +java.util.logging.FileHandler.pattern=%h/java%u.log +java.util.logging.FileHandler.limit=50000 +java.util.logging.FileHandler.count=1 +java.util.logging.FileHandler.formatter=java.util.logging.XMLFormatter + +java.util.logging.ConsoleHandler.level=ALL +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter + +#org.glassfish.level=SEVERE +#com.sun.enterprise.level=INFO http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources/test-custom-orm.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources/test-custom-orm.xml b/deltaspike/modules/data/impl/src/test/resources/test-custom-orm.xml new file mode 100644 index 0000000..bf7b4fa --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources/test-custom-orm.xml @@ -0,0 +1,43 @@ +<?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. +--> +<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd" version="2.0"> + + <package>org.apache.deltaspike.data.test.domain.mapped</package> + <mapped-superclass class="MappedSuperclass"/> + <mapped-superclass class="MappedId"> + <attributes> + <id name="id"> + <generated-value /> + </id> + </attributes> + </mapped-superclass> + <entity class="org.apache.deltaspike.data.test.domain.mapped.MappedTwo"> + <id-class class="org.apache.deltaspike.data.test.domain.TeeId"/> + <attributes> + <id name="teeSetId"/> + <id name="holeId"/> + </attributes> + </entity> + <entity class="MappedThree"> + </entity> + +</entity-mappings> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources/test-default-orm.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources/test-default-orm.xml b/deltaspike/modules/data/impl/src/test/resources/test-default-orm.xml new file mode 100644 index 0000000..2afb4f1 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources/test-default-orm.xml @@ -0,0 +1,33 @@ +<?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. +--> +<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd" version="2.0"> + + <package>org.apache.deltaspike.data.test.domain.mapped</package> + <entity class="MappedOne" name="Mapped_One"> + <attributes> + <id name="id"> + <generated-value /> + </id> + </attributes> + </entity> + +</entity-mappings> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/impl/src/test/resources/test-orm.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/test/resources/test-orm.xml b/deltaspike/modules/data/impl/src/test/resources/test-orm.xml new file mode 100644 index 0000000..129dce1 --- /dev/null +++ b/deltaspike/modules/data/impl/src/test/resources/test-orm.xml @@ -0,0 +1,32 @@ +<?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. +--> +<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd" version="2.0"> + + <persistence-unit-metadata> + <persistence-unit-defaults> + <entity-listeners> + <entity-listener class="org.apache.deltaspike.data.impl.audit.AuditEntityListener" /> + </entity-listeners> + </persistence-unit-defaults> + </persistence-unit-metadata> + +</entity-mappings> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/data/pom.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/pom.xml b/deltaspike/modules/data/pom.xml new file mode 100755 index 0000000..d61b6f6 --- /dev/null +++ b/deltaspike/modules/data/pom.xml @@ -0,0 +1,170 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.deltaspike.modules</groupId> + <artifactId>modules-project</artifactId> + <version>0.5-SNAPSHOT</version> + </parent> + + <artifactId>data-module-project</artifactId> + <packaging>pom</packaging> + <name>Apache DeltaSpike Data-Module</name> + + <developers> + <developer> + <name>Thomas Hug</name> + <email>[email protected]</email> + </developer> + <developer> + <name>Bartosz Majsak</name> + <email>[email protected]</email> + </developer> + </developers> + + <modules> + <module>api</module> + <module>impl</module> + </modules> + + <properties> + <jdk.source>1.6</jdk.source> + <jdk.target>1.6</jdk.target> + <shrinkwrap.version>2.0.0-beta-3</shrinkwrap.version> + </properties> + + <build> + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>${jdk.source}</source> + <target>${jdk.target}</target> + </configuration> + </plugin> + + </plugins> + </build> + + <repositories> + <repository> + <id>apache.snapshots</id> + <url>http://repository.apache.org/snapshots</url> + </repository> + </repositories> + + <dependencyManagement> + <dependencies> + + <dependency> + <groupId>org.apache.deltaspike.modules</groupId> + <artifactId>deltaspike-data-module-api</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.deltaspike.modules</groupId> + <artifactId>deltaspike-data-module-impl</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.deltaspike.core</groupId> + <artifactId>deltaspike-core-api</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.deltaspike.core</groupId> + <artifactId>deltaspike-core-impl</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.deltaspike.modules</groupId> + <artifactId>deltaspike-partial-bean-module-api</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.deltaspike.modules</groupId> + <artifactId>deltaspike-partial-bean-module-impl</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.hibernate.javax.persistence</groupId> + <artifactId>hibernate-jpa-2.0-api</artifactId> + <version>1.0.0.Final</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>javax.enterprise</groupId> + <artifactId>cdi-api</artifactId> + <version>1.0-SP4</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.jboss.spec.javax.ejb</groupId> + <artifactId>jboss-ejb-api_3.1_spec</artifactId> + <version>1.0.2.Final</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-bom</artifactId> + <version>${shrinkwrap.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-impl-maven</artifactId> + <version>${shrinkwrap.version}</version> + </dependency> + + </dependencies> + </dependencyManagement> + + <profiles> + <profile> + <id>tomee-build-managed</id> + </profile> + <profile> + <id>jbossas-build-managed-7</id> + </profile> + <profile> + <id>glassfish-remote-3.1</id> + </profile> + <profile> + <id>OWB</id> + </profile> + </profiles> + +</project> + http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/modules/pom.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/pom.xml b/deltaspike/modules/pom.xml index 17b7b23..7fe9ba8 100644 --- a/deltaspike/modules/pom.xml +++ b/deltaspike/modules/pom.xml @@ -41,5 +41,6 @@ <module>jsf</module> <module>partial-bean</module> <module>bean-validation</module> + <module>data</module> </modules> </project> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ae1a7147/deltaspike/parent/pom.xml ---------------------------------------------------------------------- diff --git a/deltaspike/parent/pom.xml b/deltaspike/parent/pom.xml index 9ac1d66..23d1d62 100644 --- a/deltaspike/parent/pom.xml +++ b/deltaspike/parent/pom.xml @@ -336,6 +336,15 @@ </roles> <timezone>+1</timezone> </developer> + <developer> + <id>thug</id> + <name>Thomas Hug</name> + <email>[email protected]</email> + <roles> + <role>Committer</role> + </roles> + <timezone>+1</timezone> + </developer> </developers> @@ -523,6 +532,20 @@ <scope>runtime</scope> </dependency> + <dependency> + <groupId>org.apache.deltaspike.modules</groupId> + <artifactId>deltaspike-data-module-api</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.deltaspike.modules</groupId> + <artifactId>deltaspike-data-module-impl</artifactId> + <version>${project.version}</version> + <scope>runtime</scope> + </dependency> + <!-- Dependencies for Java-SE --> <dependency> <groupId>org.apache.deltaspike.cdictrl</groupId>
