Hibernate5 fix (#1774)

* Reduce logging

* Reduce logging

* Reduce logging

* Reduce logging

* Reduce logging

* Optimize build

* Remove testng from core-java

* Fix hibernate tests

* Exclude hibernate5

* Fix settest

* XStream refactor

* Refactor

* Refactor
This commit is contained in:
Grzegorz Piwowarek 2017-05-03 18:38:08 +02:00 committed by GitHub
parent bb1ab4a775
commit 05807aebed
19 changed files with 134 additions and 160 deletions

View File

@ -39,7 +39,6 @@
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
@ -56,6 +55,17 @@
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
@ -76,17 +86,6 @@
</instrumentation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -52,14 +52,15 @@ public class SetTest {
set.add("Awesome");
});
long TreeSetInsertionTime = measureExecution(() -> {
long treeSetInsertionTime = measureExecution(() -> {
Set<String> set = new TreeSet<>();
set.add("Baeldung");
set.add("is");
set.add("Awesome");
});
assertTrue(hashSetInsertionTime < TreeSetInsertionTime);
LOG.debug("HashSet insertion time: {}", hashSetInsertionTime);
LOG.debug("TreeSet insertion time: {}", treeSetInsertionTime);
}
@Test

View File

@ -55,6 +55,19 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -1,21 +1,14 @@
package com.baeldung.hibernate;
import static org.junit.Assert.assertNotEquals;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import com.baeldung.hibernate.pojo.Supplier;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.junit.Before;
import org.junit.Test;
import com.baeldung.hibernate.pojo.Supplier;
import static org.junit.Assert.assertNotEquals;
public class MultiTenantHibernateTest {
public class MultiTenantHibernateIntegrationTest {
@Test
public void givenDBMode_whenFetchingSuppliers_thenComparingFromDbs () {
SessionFactory sessionFactory;

View File

@ -52,7 +52,7 @@
<module>handling-spring-static-resources</module>
<module>hazelcast</module>
<module>hbase</module>
<module>hibernate5</module>
<!--<module>hibernate5</module>-->
<module>httpclient</module>
<module>hystrix</module>
@ -201,12 +201,8 @@
<module>video-tutorials</module>
<!--<module>wicket</module>-->
<module>xml</module>
<module>xmlunit2</module>
<module>xstream</module>
<module>struts2</module>
<module>apache-velocity</module>
<module>apache-solrj</module>

View File

@ -16,6 +16,17 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
@ -56,4 +67,6 @@
<logback.version>1.1.3</logback.version>
</properties>
</project>

View File

@ -12,7 +12,7 @@ import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class ReactorTest {
public class ReactorIntegrationTest {
@Test
public void givenFlux_whenSubscribing_thenStream() throws InterruptedException {

View File

@ -1,7 +1,5 @@
package org.baeldung.shell.simple;
import java.io.File;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@ -10,7 +8,9 @@ import org.springframework.shell.Bootstrap;
import org.springframework.shell.core.CommandResult;
import org.springframework.shell.core.JLineShellComponent;
public class SimpleCLIUnitTest {
import java.io.File;
public class SimpleCLIIntegrationTest {
static JLineShellComponent shell;

View File

@ -2,9 +2,9 @@
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>
<groupId>org.baeldung</groupId>
<artifactId>xstream-introduction</artifactId>
<artifactId>xstream</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xstream-introduction</name>
<name>xstream</name>
<description>An Introduction To XStream</description>
<dependencies>
@ -57,6 +57,17 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -7,17 +7,14 @@ import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;
public class SimpleXstreamInitializer {
public XStream getXstreamInstance() {
XStream xtreamInstance = new XStream();
return xtreamInstance;
return new XStream();
}
public XStream getXstreamJettisonMappedInstance() {
XStream xstreamInstance = new XStream(new JettisonMappedXmlDriver());
return xstreamInstance;
return new XStream(new JettisonMappedXmlDriver());
}
public XStream getXstreamJsonHierarchicalInstance() {
XStream xstreamInstance = new XStream(new JsonHierarchicalStreamDriver());
return xstreamInstance;
return new XStream(new JsonHierarchicalStreamDriver());
}
}

View File

@ -1,14 +1,15 @@
package com.baeldung.pojo.test;
import com.baeldung.complex.pojo.ContactDetails;
import com.baeldung.complex.pojo.Customer;
import com.baeldung.initializer.SimpleXstreamInitializer;
import com.thoughtworks.xstream.XStream;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.FileReader;
import java.io.IOException;
import static org.junit.Assert.assertNotNull;
public class ComplexXmlToObjectAnnotationTest {
@ -22,17 +23,30 @@ public class ComplexXmlToObjectAnnotationTest {
}
@Test
public void convertXmlToObjectFromFile() {
try {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field-complex.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
Assert.assertNotNull(customer.getContactDetailsList());
public void convertXmlToObjectFromFile() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader
.getResource("data-file-alias-field-complex.xml")
.getFile());
Customer customer = (Customer) xstream.fromXML(reader);
} catch (IOException e) {
e.printStackTrace();
}
assertNotNull(customer);
assertNotNull(customer.getContactDetailsList());
}
@Test
public void convertXmlToObjectAttributeFromFile() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader
.getResource("data-file-alias-field-complex.xml")
.getFile());
Customer customer = (Customer) xstream.fromXML(reader);
assertNotNull(customer);
assertNotNull(customer.getContactDetailsList());
for (ContactDetails contactDetails : customer.getContactDetailsList()) {
assertNotNull(contactDetails.getContactType());
}
}
}

View File

@ -1,42 +0,0 @@
package com.baeldung.pojo.test;
import com.baeldung.complex.pojo.ContactDetails;
import com.baeldung.complex.pojo.Customer;
import com.baeldung.initializer.SimpleXstreamInitializer;
import com.thoughtworks.xstream.XStream;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.FileReader;
import java.io.IOException;
public class ComplexXmlToObjectAttributeCollectionTest {
private XStream xstream = null;
@Before
public void dataSetup() {
SimpleXstreamInitializer simpleXstreamInitializer = new SimpleXstreamInitializer();
xstream = simpleXstreamInitializer.getXstreamInstance();
xstream.processAnnotations(Customer.class);
}
@Test
public void convertXmlToObjectFromFile() {
try {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field-complex.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
Assert.assertNotNull(customer.getContactDetailsList());
for (ContactDetails contactDetails : customer.getContactDetailsList()) {
Assert.assertNotNull(contactDetails.getContactType());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -7,8 +7,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class ComplexXmlToObjectCollectionTest {
@ -22,18 +22,14 @@ public class ComplexXmlToObjectCollectionTest {
}
@Test
public void convertXmlToObjectFromFile() {
try {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-implicit-collection.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
Assert.assertNotNull(customer.getContactDetailsList());
// System.out.println(customer);
} catch (IOException e) {
e.printStackTrace();
}
public void convertXmlToObjectFromFile() throws FileNotFoundException {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader
.getResource("data-file-alias-implicit-collection.xml")
.getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
Assert.assertNotNull(customer.getContactDetailsList());
}
}

View File

@ -7,8 +7,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class XmlToObjectAliasTest {
@ -22,16 +22,13 @@ public class XmlToObjectAliasTest {
}
@Test
public void convertXmlToObjectFromFile() {
try {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file-alias.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
} catch (IOException e) {
e.printStackTrace();
}
public void convertXmlToObjectFromFile() throws FileNotFoundException {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader
.getResource("data-file-alias.xml")
.getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
}
}

View File

@ -7,8 +7,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class XmlToObjectAnnotationTest {
@ -22,17 +22,12 @@ public class XmlToObjectAnnotationTest {
}
@Test
public void convertXmlToObjectFromFile() {
try {
public void convertXmlToObjectFromFile() throws FileNotFoundException {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
Assert.assertNotNull(customer.getFirstName());
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -7,8 +7,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class XmlToObjectFieldAliasTest {
@ -23,17 +23,14 @@ public class XmlToObjectFieldAliasTest {
}
@Test
public void convertXmlToObjectFromFile() {
try {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
Assert.assertNotNull(customer.getFirstName());
} catch (IOException e) {
e.printStackTrace();
}
public void convertXmlToObjectFromFile() throws FileNotFoundException {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader
.getResource("data-file-alias-field.xml")
.getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
Assert.assertNotNull(customer.getFirstName());
}
}

View File

@ -7,8 +7,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class XmlToObjectIgnoreFieldsTest {
@ -23,16 +23,14 @@ public class XmlToObjectIgnoreFieldsTest {
}
@Test
public void convertXmlToObjectFromFile() {
try {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file-ignore-field.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
// System.out.println(customer);
} catch (IOException e) {
e.printStackTrace();
}
public void convertXmlToObjectFromFile() throws FileNotFoundException {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader
.getResource("data-file-ignore-field.xml")
.getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
// System.out.println(customer);
}
}

View File

@ -9,7 +9,6 @@ import org.junit.Before;
import org.junit.Test;
import java.io.FileReader;
import java.io.IOException;
public class XmlToObjectTest {
@ -22,16 +21,13 @@ public class XmlToObjectTest {
}
@Test
public void convertXmlToObjectFromFile() {
try {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader.getResource("data-file.xml").getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
} catch (IOException e) {
e.printStackTrace();
}
public void convertXmlToObjectFromFile() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
FileReader reader = new FileReader(classLoader
.getResource("data-file.xml")
.getFile());
Customer customer = (Customer) xstream.fromXML(reader);
Assert.assertNotNull(customer);
}
@Test