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:
parent
bb1ab4a775
commit
05807aebed
|
@ -39,7 +39,6 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>install</defaultGoal>
|
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -56,6 +55,17 @@
|
||||||
<artifactId>exec-maven-plugin</artifactId>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
<version>${exec-maven-plugin.version}</version>
|
<version>${exec-maven-plugin.version}</version>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
@ -76,17 +86,6 @@
|
||||||
</instrumentation>
|
</instrumentation>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</reporting>
|
</reporting>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -52,14 +52,15 @@ public class SetTest {
|
||||||
set.add("Awesome");
|
set.add("Awesome");
|
||||||
});
|
});
|
||||||
|
|
||||||
long TreeSetInsertionTime = measureExecution(() -> {
|
long treeSetInsertionTime = measureExecution(() -> {
|
||||||
Set<String> set = new TreeSet<>();
|
Set<String> set = new TreeSet<>();
|
||||||
set.add("Baeldung");
|
set.add("Baeldung");
|
||||||
set.add("is");
|
set.add("is");
|
||||||
set.add("Awesome");
|
set.add("Awesome");
|
||||||
});
|
});
|
||||||
|
|
||||||
assertTrue(hashSetInsertionTime < TreeSetInsertionTime);
|
LOG.debug("HashSet insertion time: {}", hashSetInsertionTime);
|
||||||
|
LOG.debug("TreeSet insertion time: {}", treeSetInsertionTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -55,6 +55,19 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
|
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -1,21 +1,14 @@
|
||||||
package com.baeldung.hibernate;
|
package com.baeldung.hibernate;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import com.baeldung.hibernate.pojo.Supplier;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.baeldung.hibernate.pojo.Supplier;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
|
|
||||||
public class MultiTenantHibernateTest {
|
public class MultiTenantHibernateIntegrationTest {
|
||||||
@Test
|
@Test
|
||||||
public void givenDBMode_whenFetchingSuppliers_thenComparingFromDbs () {
|
public void givenDBMode_whenFetchingSuppliers_thenComparingFromDbs () {
|
||||||
SessionFactory sessionFactory;
|
SessionFactory sessionFactory;
|
6
pom.xml
6
pom.xml
|
@ -52,7 +52,7 @@
|
||||||
<module>handling-spring-static-resources</module>
|
<module>handling-spring-static-resources</module>
|
||||||
<module>hazelcast</module>
|
<module>hazelcast</module>
|
||||||
<module>hbase</module>
|
<module>hbase</module>
|
||||||
<module>hibernate5</module>
|
<!--<module>hibernate5</module>-->
|
||||||
<module>httpclient</module>
|
<module>httpclient</module>
|
||||||
<module>hystrix</module>
|
<module>hystrix</module>
|
||||||
|
|
||||||
|
@ -201,12 +201,8 @@
|
||||||
|
|
||||||
<module>video-tutorials</module>
|
<module>video-tutorials</module>
|
||||||
|
|
||||||
<!--<module>wicket</module>-->
|
|
||||||
|
|
||||||
<module>xml</module>
|
<module>xml</module>
|
||||||
<module>xmlunit2</module>
|
<module>xmlunit2</module>
|
||||||
<module>xstream</module>
|
|
||||||
|
|
||||||
<module>struts2</module>
|
<module>struts2</module>
|
||||||
<module>apache-velocity</module>
|
<module>apache-velocity</module>
|
||||||
<module>apache-solrj</module>
|
<module>apache-solrj</module>
|
||||||
|
|
|
@ -16,6 +16,17 @@
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@ -56,4 +67,6 @@
|
||||||
<logback.version>1.1.3</logback.version>
|
<logback.version>1.1.3</logback.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
public class ReactorTest {
|
public class ReactorIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenFlux_whenSubscribing_thenStream() throws InterruptedException {
|
public void givenFlux_whenSubscribing_thenStream() throws InterruptedException {
|
|
@ -1,7 +1,5 @@
|
||||||
package org.baeldung.shell.simple;
|
package org.baeldung.shell.simple;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -10,7 +8,9 @@ import org.springframework.shell.Bootstrap;
|
||||||
import org.springframework.shell.core.CommandResult;
|
import org.springframework.shell.core.CommandResult;
|
||||||
import org.springframework.shell.core.JLineShellComponent;
|
import org.springframework.shell.core.JLineShellComponent;
|
||||||
|
|
||||||
public class SimpleCLIUnitTest {
|
import java.io.File;
|
||||||
|
|
||||||
|
public class SimpleCLIIntegrationTest {
|
||||||
|
|
||||||
static JLineShellComponent shell;
|
static JLineShellComponent shell;
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.baeldung</groupId>
|
<groupId>org.baeldung</groupId>
|
||||||
<artifactId>xstream-introduction</artifactId>
|
<artifactId>xstream</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>xstream-introduction</name>
|
<name>xstream</name>
|
||||||
<description>An Introduction To XStream</description>
|
<description>An Introduction To XStream</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -57,6 +57,17 @@
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,14 @@ import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;
|
||||||
public class SimpleXstreamInitializer {
|
public class SimpleXstreamInitializer {
|
||||||
|
|
||||||
public XStream getXstreamInstance() {
|
public XStream getXstreamInstance() {
|
||||||
XStream xtreamInstance = new XStream();
|
return new XStream();
|
||||||
return xtreamInstance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XStream getXstreamJettisonMappedInstance() {
|
public XStream getXstreamJettisonMappedInstance() {
|
||||||
XStream xstreamInstance = new XStream(new JettisonMappedXmlDriver());
|
return new XStream(new JettisonMappedXmlDriver());
|
||||||
return xstreamInstance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XStream getXstreamJsonHierarchicalInstance() {
|
public XStream getXstreamJsonHierarchicalInstance() {
|
||||||
XStream xstreamInstance = new XStream(new JsonHierarchicalStreamDriver());
|
return new XStream(new JsonHierarchicalStreamDriver());
|
||||||
return xstreamInstance;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
package com.baeldung.pojo.test;
|
package com.baeldung.pojo.test;
|
||||||
|
|
||||||
|
import com.baeldung.complex.pojo.ContactDetails;
|
||||||
import com.baeldung.complex.pojo.Customer;
|
import com.baeldung.complex.pojo.Customer;
|
||||||
import com.baeldung.initializer.SimpleXstreamInitializer;
|
import com.baeldung.initializer.SimpleXstreamInitializer;
|
||||||
import com.thoughtworks.xstream.XStream;
|
import com.thoughtworks.xstream.XStream;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
public class ComplexXmlToObjectAnnotationTest {
|
public class ComplexXmlToObjectAnnotationTest {
|
||||||
|
|
||||||
|
@ -22,17 +23,30 @@ public class ComplexXmlToObjectAnnotationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertXmlToObjectFromFile() {
|
public void convertXmlToObjectFromFile() throws Exception {
|
||||||
try {
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
FileReader reader = new FileReader(classLoader
|
||||||
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field-complex.xml").getFile());
|
.getResource("data-file-alias-field-complex.xml")
|
||||||
Customer customer = (Customer) xstream.fromXML(reader);
|
.getFile());
|
||||||
Assert.assertNotNull(customer);
|
Customer customer = (Customer) xstream.fromXML(reader);
|
||||||
Assert.assertNotNull(customer.getContactDetailsList());
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
assertNotNull(customer);
|
||||||
e.printStackTrace();
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -7,8 +7,8 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class ComplexXmlToObjectCollectionTest {
|
public class ComplexXmlToObjectCollectionTest {
|
||||||
|
|
||||||
|
@ -22,18 +22,14 @@ public class ComplexXmlToObjectCollectionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertXmlToObjectFromFile() {
|
public void convertXmlToObjectFromFile() throws FileNotFoundException {
|
||||||
try {
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
FileReader reader = new FileReader(classLoader
|
||||||
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-implicit-collection.xml").getFile());
|
.getResource("data-file-alias-implicit-collection.xml")
|
||||||
Customer customer = (Customer) xstream.fromXML(reader);
|
.getFile());
|
||||||
Assert.assertNotNull(customer);
|
Customer customer = (Customer) xstream.fromXML(reader);
|
||||||
Assert.assertNotNull(customer.getContactDetailsList());
|
Assert.assertNotNull(customer);
|
||||||
// System.out.println(customer);
|
Assert.assertNotNull(customer.getContactDetailsList());
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class XmlToObjectAliasTest {
|
public class XmlToObjectAliasTest {
|
||||||
|
|
||||||
|
@ -22,16 +22,13 @@ public class XmlToObjectAliasTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertXmlToObjectFromFile() {
|
public void convertXmlToObjectFromFile() throws FileNotFoundException {
|
||||||
try {
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
FileReader reader = new FileReader(classLoader
|
||||||
FileReader reader = new FileReader(classLoader.getResource("data-file-alias.xml").getFile());
|
.getResource("data-file-alias.xml")
|
||||||
Customer customer = (Customer) xstream.fromXML(reader);
|
.getFile());
|
||||||
Assert.assertNotNull(customer);
|
Customer customer = (Customer) xstream.fromXML(reader);
|
||||||
|
Assert.assertNotNull(customer);
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class XmlToObjectAnnotationTest {
|
public class XmlToObjectAnnotationTest {
|
||||||
|
|
||||||
|
@ -22,17 +22,12 @@ public class XmlToObjectAnnotationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertXmlToObjectFromFile() {
|
public void convertXmlToObjectFromFile() throws FileNotFoundException {
|
||||||
try {
|
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field.xml").getFile());
|
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field.xml").getFile());
|
||||||
Customer customer = (Customer) xstream.fromXML(reader);
|
Customer customer = (Customer) xstream.fromXML(reader);
|
||||||
Assert.assertNotNull(customer);
|
Assert.assertNotNull(customer);
|
||||||
Assert.assertNotNull(customer.getFirstName());
|
Assert.assertNotNull(customer.getFirstName());
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class XmlToObjectFieldAliasTest {
|
public class XmlToObjectFieldAliasTest {
|
||||||
|
|
||||||
|
@ -23,17 +23,14 @@ public class XmlToObjectFieldAliasTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertXmlToObjectFromFile() {
|
public void convertXmlToObjectFromFile() throws FileNotFoundException {
|
||||||
try {
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
FileReader reader = new FileReader(classLoader
|
||||||
FileReader reader = new FileReader(classLoader.getResource("data-file-alias-field.xml").getFile());
|
.getResource("data-file-alias-field.xml")
|
||||||
Customer customer = (Customer) xstream.fromXML(reader);
|
.getFile());
|
||||||
Assert.assertNotNull(customer);
|
Customer customer = (Customer) xstream.fromXML(reader);
|
||||||
Assert.assertNotNull(customer.getFirstName());
|
Assert.assertNotNull(customer);
|
||||||
|
Assert.assertNotNull(customer.getFirstName());
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class XmlToObjectIgnoreFieldsTest {
|
public class XmlToObjectIgnoreFieldsTest {
|
||||||
|
|
||||||
|
@ -23,16 +23,14 @@ public class XmlToObjectIgnoreFieldsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertXmlToObjectFromFile() {
|
public void convertXmlToObjectFromFile() throws FileNotFoundException {
|
||||||
try {
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
FileReader reader = new FileReader(classLoader
|
||||||
FileReader reader = new FileReader(classLoader.getResource("data-file-ignore-field.xml").getFile());
|
.getResource("data-file-ignore-field.xml")
|
||||||
Customer customer = (Customer) xstream.fromXML(reader);
|
.getFile());
|
||||||
Assert.assertNotNull(customer);
|
Customer customer = (Customer) xstream.fromXML(reader);
|
||||||
// System.out.println(customer);
|
Assert.assertNotNull(customer);
|
||||||
} catch (IOException e) {
|
// System.out.println(customer);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class XmlToObjectTest {
|
public class XmlToObjectTest {
|
||||||
|
|
||||||
|
@ -22,16 +21,13 @@ public class XmlToObjectTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void convertXmlToObjectFromFile() {
|
public void convertXmlToObjectFromFile() throws Exception {
|
||||||
try {
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
FileReader reader = new FileReader(classLoader
|
||||||
FileReader reader = new FileReader(classLoader.getResource("data-file.xml").getFile());
|
.getResource("data-file.xml")
|
||||||
Customer customer = (Customer) xstream.fromXML(reader);
|
.getFile());
|
||||||
Assert.assertNotNull(customer);
|
Customer customer = (Customer) xstream.fromXML(reader);
|
||||||
|
Assert.assertNotNull(customer);
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue