Skip to content

Commit

Permalink
hibernate 5
Browse files Browse the repository at this point in the history
update module names

clean up hibernate config and commonize testng.xml

accessIT

EmbeddedIT

groovy tests

fix build warnings

fix plugin versions

reuse pom inheritance and minimize global pom properties

rebase

fix comment

skip install

minimize logs

new container

installing libaio1

mysql service

options
  • Loading branch information
Daniel Chen committed Nov 24, 2015
1 parent 9bcf9e1 commit 383c7f0
Show file tree
Hide file tree
Showing 37 changed files with 1,680 additions and 381 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
global:
- secure: VV+uJlBgXRCUSj3+khXnKvbrB0bxtay3yovKAchTT83Y6+iXUAgp3b7EA1QjT0l3Hz88Y+EAVuiZqwzFRidbZwbgApaxYMJKWjHTmr+VsXXJp29J1tyGtXR1K+DUG0HO/jiRCxMVythB68BnNMIXfprpmsLFpXhKMPf41fzMaAtqSYrPdJkNvEzBDhu5hIPG9apyEcpIZNhtfwnk18DntyGFC3OVAKzEma51s0tS6NeXiZNzTvc9j0d4Fr8vyWGclAp1XKMjWzpvfRyB2EFto076V+8tJ5E3czJjJs12SDwOvEdzYeCpGk3VWboiz9DuZn41IdTLYy89OmcIooZQHViMwiatcqqHREEbuuUWZLYMEh1bUHZHRWQf2AnUScDfJB1QUKVR8mbkSr5DXto4FIsHpqofoBloDveaXkWC735DqOPwbIwe2owGZfkQv19vPpVvF3e2LyFn1vf8blR3wFBItKKZyvBTbrIVM/YxuTDfswDVlhEgHTeet0TQSy4yEoMxGTHsfk8Ykc2B0JDheWH5zhhZBdozmV5TFbM50PXjLqfqWVDD+WqzGVer1Sokfv6MMERoWKvb/LEyKO4Eq3aHgXyy2GoRQHfUh9qOOvBnNpHbtacL+NzfggLZ1Ut97QIbEoWb3VPx6lbNKxiiC4DbwR7nnc92zNJM5YU6Dog=
- secure: SSqm3fI2slK6qcmfeRiWvQJ8kNd5VQD6wSkFM5NMCo7Uvo3peNNwCDiTpWMN6nNuM4LSJJhgGwDLZeIlRF4i74xgWpDznjZ4AoqgG1QeIjg/4Xdy+szz0+BiTdUhQnRsaKHfUoky4wm+Jrix1rYgz/eED6uiOHmgLWywD4+BEBHN37N5N6/vT7ELkxi/jzXWOunMA12Y6F+LFcw4A87qM94iFws94C0BEqfWRqaXYPZoQ7v5Yw7TilJuPGiL6pcdWyh5ObfAhIbHhhxmIvaMFWV7HGoB1rC2T/E/GQynKU/l1uQHTf/rNK70uUTCKz3usl28AnVsnyhjg7+Ivk22Z0pSnZtLw1TJT5prPdX+Cas8NEElk6zSS/h3lMmQuGZk8T6FmsqkDx3tkFiJqgxvbgGLZBMgYdm87OCzrM55ZTlxBOYErQQgFrevJ2oJV98Pb4DNCPx5uu/CVCbR+d1kZ6b91rabzjl+a3yiz10vnaO00dyW1gR1P0KHZiRactdds2jLsxBhr3MFDymZD7W+WhuI4RtP2/bsQQ1dnLIvWm+JYmDvr09/7k1uX7WCm9AkMb0u1gW19WYQT1Qct3hFfvKIbgv3gTNJz2+Alu3mqeIpSkmtdtGjVMij3/0OBdYBNC+BfaR4IQVnIbvyu0HmjtJgRji2TO/U7rCUKjOrm6c=
- MAVEN_OPTS="-XX:MaxPermSize=2g -Xmx4g"
- JAVA_OPTS="-XX:MaxPermSize=2g -Xmx4g"
branches:
only:
- master
- "/^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+/"

# build steps
before_install:
- sudo apt-get install libaio1
script: mvn verify
install: true
script: mvn clean verify
after_success:
- test "${TRAVIS_PULL_REQUEST}" == "false" && test "${TRAVIS_TAG}" != "" && mvn deploy --settings travis/settings.xml
# before_deploy: cat travis/bintray_template.json | sed s/\$\{TRAVIS_TAG\}/${TRAVIS_TAG}/g > travis/release.json
Expand Down
36 changes: 6 additions & 30 deletions elide-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>elide-core</artifactId>
<packaging>jar</packaging>
<name>Elide Core</name>
<name>Elide: Core</name>
<description>Elide Core</description>
<url>https://github.com/yahoo/elide</url>
<parent>
Expand All @@ -25,6 +25,11 @@
</license>
</licenses>

<organization>
<name>Yahoo! Inc.</name>
<url>http://www.yahoo.com</url>
</organization>

<developers>
<developer>
<name>Yahoo Inc.</name>
Expand All @@ -38,11 +43,6 @@
<tag>HEAD</tag>
</scm>

<properties>
<version.hk2>2.4.0-b32</version.hk2>
<version.logback>1.1.3</version.logback>
</properties>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
Expand All @@ -52,11 +52,6 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-api</artifactId>
<version>${version.hk2}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
Expand Down Expand Up @@ -118,13 +113,11 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${version.logback}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${version.logback}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -150,7 +143,6 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -186,18 +178,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
Expand All @@ -215,8 +195,4 @@
</plugin>
</plugins>
</build>
<organization>
<name>Yahoo! Inc.</name>
<url>http://www.yahoo.com/</url>
</organization>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
import org.apache.commons.beanutils.Converter;

/**
* Uses Jackson to Convert from Map to target object
* Uses Jackson to Convert from Map to target object.
*/
public class FromMapConverter implements Converter {
/**
* Convert value to Enum
* Convert value to Enum.
*
* @param cls class to convert to
* @param value value to convert
* @param <T>
Expand Down
14 changes: 1 addition & 13 deletions elide-datastore/elide-datastore-hibernate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>elide-datastore-hibernate</artifactId>
<packaging>jar</packaging>
<name>Elide Hibernate Common</name>
<name>Elide Data Store: Hibernate Common</name>
<description>Common files for Elide Data Store Hibernate3 and Hibernate5</description>
<url>https://github.com/yahoo/elide</url>
<parent>
Expand Down Expand Up @@ -70,22 +70,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Set;

/**
* FilterOperation that creates Hibernate query language fragments
* FilterOperation that creates Hibernate query language fragments.
*/
public class HQLFilterOperation implements FilterOperation<String> {
@Override
Expand Down
1 change: 0 additions & 1 deletion elide-datastore/elide-datastore-hibernate3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ elide-datastore-hibernate3
==========================

[![Dependency Status](https://www.versioneye.com/user/projects/5621504036d0ab0019000901/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5621504036d0ab0019000901)

24 changes: 7 additions & 17 deletions elide-datastore/elide-datastore-hibernate3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>elide-datastore-hibernate3</artifactId>
<packaging>jar</packaging>
<name>Elide Hibernate3 Data Store</name>
<description>Elide Data Store for Hibernate3 support</description>
<name>Elide Data Store: Hibernate 3</name>
<description>Elide Data Store for Hibernate 3 support</description>
<url>https://github.com/yahoo/elide</url>
<parent>
<groupId>com.yahoo.elide</groupId>
Expand Down Expand Up @@ -56,17 +56,19 @@
<dependency>
<groupId>com.yahoo.elide</groupId>
<artifactId>elide-datastore-hibernate</artifactId>
<version>1.0.0.9-SNAPSHOT</version>
<version>1.0.0.10-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.yahoo.elide</groupId>
<artifactId>elide-integration-tests</artifactId>
<version>1.0.0.9-SNAPSHOT</version>
<version>1.0.0.10-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<!-- Hibernate 3 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
Expand Down Expand Up @@ -101,7 +103,7 @@
<version>2.6.3</version>
</dependency>

<!-- Integration test dependencies -->
<!-- Integration test -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down Expand Up @@ -156,22 +158,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,39 @@
import org.hibernate.cfg.Environment;
import org.hibernate.tool.hbm2ddl.SchemaExport;

import java.util.function.Supplier;

import javax.persistence.Entity;
import java.util.function.Supplier;

/**
* Supplier of Hibernate5 Data Store.
* Supplier of Hibernate 3 Data Store.
*/
public class HibernateDataStoreSupplier implements Supplier<DataStore> {
@Override
public DataStore get() {
// method to force class initialization
Configuration c = new Configuration();

Configuration configuration = new Configuration();
try {
ClassScanner.getAnnotatedClasses(Parent.class.getPackage(), Entity.class).forEach(c::addAnnotatedClass);
ClassScanner.getAnnotatedClasses(Parent.class.getPackage(), Entity.class)
.forEach(configuration::addAnnotatedClass);
} catch (MappingException e) {
throw new RuntimeException(e);
}

SessionFactory sessionFactory = c.configure("hibernate.cfg.xml")
SessionFactory sessionFactory = configuration.configure("hibernate.cfg.xml")
.setProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread")
.setProperty(Environment.URL,
"jdbc:mysql://localhost:" + System.getProperty("mysql.port", "3306") + "/root")
.setProperty(Environment.USER, "root")
.setProperty(Environment.PASS, "root")
.buildSessionFactory();

// create Example tables from beans
SchemaExport se = new SchemaExport(c).setHaltOnError(true);
se.drop(false, true);
se.execute(false, true, false, true);
// create example tables from beans
SchemaExport schemaExport = new SchemaExport(configuration).setHaltOnError(true);
schemaExport.drop(false, true);
schemaExport.execute(false, true, false, true);

if (se.getExceptions().size() != 0) {
throw new RuntimeException("" + se.getExceptions());
if (!schemaExport.getExceptions().isEmpty()) {
throw new RuntimeException("" + schemaExport.getExceptions());
}

return new HibernateStore(sessionFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See LICENSE file in project root for terms.
*/

package usertypes;
package com.yahoo.elide.datastores.hibernate3.usertypes;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -21,7 +21,6 @@
import java.util.Objects;
import java.util.Properties;


/**
* JsonType serializes an object to json string and vice versa
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
package example;

import com.yahoo.elide.datastores.hibernate3.usertypes.JsonType;
import org.hibernate.annotations.TypeDef;
import usertypes.JsonType;

@TypeDef(typeClass = JsonType.class, name = "json")
public class AddressFragment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import javax.persistence.Entity;
import javax.persistence.Id;


@Entity
@Include(rootLevel = true)
public class Person {
Expand All @@ -35,7 +34,7 @@ public long getId() {
}

@Column(name = "address", columnDefinition = "TEXT")
@Type(type = "usertypes.JsonType", parameters = {
@Type(type = "com.yahoo.elide.datastores.hibernate3.usertypes.JsonType", parameters = {
@Parameter(name = "class", value = "example.AddressFragment")
})
public AddressFragment getAddress() {
Expand Down
19 changes: 0 additions & 19 deletions elide-datastore/elide-datastore-hibernate3/testng.xml

This file was deleted.

Loading

0 comments on commit 383c7f0

Please sign in to comment.