diff --git a/bootique/dependency-reduced-pom.xml b/bootique/dependency-reduced-pom.xml index ed18f4e42a..ab09cfb7b1 100644 --- a/bootique/dependency-reduced-pom.xml +++ b/bootique/dependency-reduced-pom.xml @@ -28,8 +28,14 @@ junit junit - 3.8.1 + 4.12 test + + + hamcrest-core + org.hamcrest + + diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/stopping/StopThreadTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/stopping/StopThreadTest.java index 8c1bdbf787..70854f013f 100644 --- a/core-java-concurrency/src/test/java/com/baeldung/concurrent/stopping/StopThreadTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/stopping/StopThreadTest.java @@ -1,7 +1,11 @@ package com.baeldung.concurrent.stopping; +import com.jayway.awaitility.Awaitility; import org.junit.Test; +import java.util.concurrent.TimeUnit; + +import static com.jayway.awaitility.Awaitility.await; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -22,11 +26,10 @@ public class StopThreadTest { // Stop it and make sure the flags have been reversed controlSubThread.stop(); - Thread.sleep(interval); - assertTrue(controlSubThread.isStopped()); + await() + .until(() -> assertTrue(controlSubThread.isStopped())); } - @Test public void whenInterruptedThreadIsStopped() throws InterruptedException { @@ -44,7 +47,8 @@ public class StopThreadTest { controlSubThread.interrupt(); // Wait less than the time we would normally sleep, and make sure we exited. - Thread.sleep(interval/10); - assertTrue(controlSubThread.isStopped()); + Awaitility.await() + .atMost(interval/ 10, TimeUnit.MILLISECONDS) + .until(controlSubThread::isStopped); } } diff --git a/core-java-sun/.gitignore b/core-java-sun/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/core-java-sun/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-sun/README.md b/core-java-sun/README.md new file mode 100644 index 0000000000..9cf8b26f1b --- /dev/null +++ b/core-java-sun/README.md @@ -0,0 +1,6 @@ +========= + +## Core Java Cookbooks and Examples + +### Relevant Articles: +- [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) diff --git a/core-java-sun/pom.xml b/core-java-sun/pom.xml new file mode 100644 index 0000000000..3997f47d19 --- /dev/null +++ b/core-java-sun/pom.xml @@ -0,0 +1,489 @@ + + 4.0.0 + com.baeldung + core-java-sun + 0.1.0-SNAPSHOT + jar + + core-java-sun + + + + + + net.sourceforge.collections + collections-generic + ${collections-generic.version} + + + com.google.guava + guava + ${guava.version} + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + + commons-io + commons-io + ${commons-io.version} + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + + org.decimal4j + decimal4j + ${decimal4j.version} + + + + org.bouncycastle + bcprov-jdk15on + ${bouncycastle.version} + + + + org.unix4j + unix4j-command + ${unix4j.version} + + + + com.googlecode.grep4j + grep4j + ${grep4j.version} + + + + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + + log4j + log4j + 1.2.17 + + + org.slf4j + slf4j-api + ${org.slf4j.version} + + + ch.qos.logback + logback-classic + ${logback.version} + + + + org.slf4j + jcl-over-slf4j + ${org.slf4j.version} + + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + + org.hamcrest + hamcrest-all + 1.3 + test + + + + junit + junit + ${junit.version} + test + + + + org.hamcrest + hamcrest-core + ${org.hamcrest.version} + test + + + org.hamcrest + hamcrest-library + ${org.hamcrest.version} + test + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + org.mockito + mockito-core + ${mockito.version} + test + + + com.jayway.awaitility + awaitility + ${avaitility.version} + test + + + + commons-codec + commons-codec + ${commons-codec.version} + + + + org.javamoney + moneta + 1.1 + + + + org.owasp.esapi + esapi + 2.1.0.1 + + + + com.sun.messaging.mq + fscontext + ${fscontext.version} + + + com.codepoetics + protonpack + ${protonpack.version} + + + one.util + streamex + ${streamex.version} + + + io.vavr + vavr + ${vavr.version} + + + org.openjdk.jmh + jmh-core + 1.19 + + + org.openjdk.jmh + jmh-generator-annprocess + 1.19 + + + org.springframework + spring-web + 4.3.4.RELEASE + + + com.sun + tools + 1.8.0 + system + ${java.home}/../lib/tools.jar + + + + + core-java + + + src/main/resources + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + libs/ + org.baeldung.executable.ExecutableMavenJar + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + ${project.basedir} + + + org.baeldung.executable.ExecutableMavenJar + + + + jar-with-dependencies + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + + shade + + + true + + + org.baeldung.executable.ExecutableMavenJar + + + + + + + + + com.jolira + onejar-maven-plugin + + + + org.baeldung.executable.ExecutableMavenJar + true + ${project.build.finalName}-onejar.${project.packaging} + + + one-jar + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + spring-boot + org.baeldung.executable.ExecutableMavenJar + + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + java + com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed + + -Xmx300m + -XX:+UseParallelGC + -classpath + + com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed + + + + + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + org.codehaus.mojo + exec-maven-plugin + + + + run-benchmarks + + none + + exec + + + test + java + + -classpath + + org.openjdk.jmh.Main + .* + + + + + + + + + + + + + 2.8.5 + + + 1.7.21 + 1.1.7 + + + 23.0 + 3.5 + 1.55 + 1.10 + 3.6.1 + 1.0.3 + 2.5 + 4.1 + 4.01 + 0.4 + 1.8.7 + 1.16.12 + 4.6-b01 + 1.13 + 0.6.5 + 0.9.0 + + + 1.3 + 4.12 + 2.8.9 + 3.6.1 + 1.7.0 + + + 3.6.0 + 2.19.1 + + \ No newline at end of file diff --git a/core-java-sun/src/main/java/com/baeldung/.gitignore b/core-java-sun/src/main/java/com/baeldung/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/core-java-sun/src/main/java/com/baeldung/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/core-java-sun/src/main/java/com/baeldung/README.md b/core-java-sun/src/main/java/com/baeldung/README.md new file mode 100644 index 0000000000..51809b2882 --- /dev/null +++ b/core-java-sun/src/main/java/com/baeldung/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [SHA-256 Hashing in Java](http://www.baeldung.com/sha-256-hashing-java) diff --git a/core-java/src/main/java/com/baeldung/javac/Positive.java b/core-java-sun/src/main/java/com/baeldung/javac/Positive.java similarity index 100% rename from core-java/src/main/java/com/baeldung/javac/Positive.java rename to core-java-sun/src/main/java/com/baeldung/javac/Positive.java diff --git a/core-java/src/main/java/com/baeldung/javac/SampleJavacPlugin.java b/core-java-sun/src/main/java/com/baeldung/javac/SampleJavacPlugin.java similarity index 100% rename from core-java/src/main/java/com/baeldung/javac/SampleJavacPlugin.java rename to core-java-sun/src/main/java/com/baeldung/javac/SampleJavacPlugin.java diff --git a/core-java-sun/src/main/resources/log4j.properties b/core-java-sun/src/main/resources/log4j.properties new file mode 100644 index 0000000000..621cf01735 --- /dev/null +++ b/core-java-sun/src/main/resources/log4j.properties @@ -0,0 +1,6 @@ +log4j.rootLogger=DEBUG, A1 + +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n \ No newline at end of file diff --git a/core-java-sun/src/main/resources/logback.xml b/core-java-sun/src/main/resources/logback.xml new file mode 100644 index 0000000000..ec0dc2469a --- /dev/null +++ b/core-java-sun/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + web - %date [%thread] %-5level %logger{36} - %message%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/javac/SampleJavacPluginIntegrationTest.java b/core-java-sun/src/test/java/com/baeldung/javac/SampleJavacPluginIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/javac/SampleJavacPluginIntegrationTest.java rename to core-java-sun/src/test/java/com/baeldung/javac/SampleJavacPluginIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/javac/SimpleClassFile.java b/core-java-sun/src/test/java/com/baeldung/javac/SimpleClassFile.java similarity index 100% rename from core-java/src/test/java/com/baeldung/javac/SimpleClassFile.java rename to core-java-sun/src/test/java/com/baeldung/javac/SimpleClassFile.java diff --git a/core-java/src/test/java/com/baeldung/javac/SimpleFileManager.java b/core-java-sun/src/test/java/com/baeldung/javac/SimpleFileManager.java similarity index 100% rename from core-java/src/test/java/com/baeldung/javac/SimpleFileManager.java rename to core-java-sun/src/test/java/com/baeldung/javac/SimpleFileManager.java diff --git a/core-java/src/test/java/com/baeldung/javac/SimpleSourceFile.java b/core-java-sun/src/test/java/com/baeldung/javac/SimpleSourceFile.java similarity index 100% rename from core-java/src/test/java/com/baeldung/javac/SimpleSourceFile.java rename to core-java-sun/src/test/java/com/baeldung/javac/SimpleSourceFile.java diff --git a/core-java/src/test/java/com/baeldung/javac/TestCompiler.java b/core-java-sun/src/test/java/com/baeldung/javac/TestCompiler.java similarity index 100% rename from core-java/src/test/java/com/baeldung/javac/TestCompiler.java rename to core-java-sun/src/test/java/com/baeldung/javac/TestCompiler.java diff --git a/core-java/src/test/java/com/baeldung/javac/TestRunner.java b/core-java-sun/src/test/java/com/baeldung/javac/TestRunner.java similarity index 100% rename from core-java/src/test/java/com/baeldung/javac/TestRunner.java rename to core-java-sun/src/test/java/com/baeldung/javac/TestRunner.java diff --git a/core-java-sun/src/test/resources/.gitignore b/core-java-sun/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/core-java-sun/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/core-java/pom.xml b/core-java/pom.xml index 77000b8741..2c4cbfc37b 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -181,11 +181,6 @@ 2.1.0.1 - - com.sun.messaging.mq - fscontext - ${fscontext.version} - com.codepoetics protonpack @@ -216,13 +211,6 @@ spring-web 4.3.4.RELEASE - - com.sun - tools - 1.8.0 - system - ${java.home}/../lib/tools.jar - diff --git a/core-java/src/test/java/com/baeldung/file/FileOutputStreamTest.java b/core-java/src/test/java/com/baeldung/file/FileOutputStreamTest.java deleted file mode 100644 index 451c1b4c4d..0000000000 --- a/core-java/src/test/java/com/baeldung/file/FileOutputStreamTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.file; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; - -import org.junit.After; -import org.junit.Test; - -import com.baeldung.util.StreamUtils; - -public class FileOutputStreamTest { - - public static final String fileName = "src/main/resources/countries.properties"; - - @Test - public void whenAppendToFileUsingFileOutputStream_thenCorrect() throws Exception { - FileOutputStream fos = new FileOutputStream(fileName, true); - fos.write("Spain\r\n".getBytes()); - fos.close(); - - assertThat(StreamUtils.getStringFromInputStream( - new FileInputStream(fileName))) - .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); - } - - @After - public void revertFile() throws IOException { - PrintWriter writer = new PrintWriter(fileName); - writer.print("UK\r\n" + "US\r\n" + "Germany\r\n"); - writer.close(); - } -} diff --git a/core-java/src/test/java/com/baeldung/file/FileUtilsTest.java b/core-java/src/test/java/com/baeldung/file/FileUtilsTest.java deleted file mode 100644 index 9ee8726575..0000000000 --- a/core-java/src/test/java/com/baeldung/file/FileUtilsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.file; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; - -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Test; - -import com.baeldung.util.StreamUtils; - -public class FileUtilsTest { - - public static final String fileName = "src/main/resources/countries.properties"; - - @Test - public void whenAppendToFileUsingFiles_thenCorrect() throws IOException { - File file = new File(fileName); - FileUtils.writeStringToFile(file, "Spain\r\n", StandardCharsets.UTF_8, true); - - assertThat(StreamUtils.getStringFromInputStream( - new FileInputStream(fileName))) - .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); - } - - @After - public void revertFile() throws IOException { - PrintWriter writer = new PrintWriter(fileName); - writer.print("UK\r\n" + "US\r\n" + "Germany\r\n"); - writer.close(); - } -} diff --git a/core-java/src/test/java/com/baeldung/file/FileWriterTest.java b/core-java/src/test/java/com/baeldung/file/FileWriterTest.java deleted file mode 100644 index 8d2ce4310e..0000000000 --- a/core-java/src/test/java/com/baeldung/file/FileWriterTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.file; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.BufferedWriter; -import java.io.FileInputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -import org.junit.After; -import org.junit.Test; - -import com.baeldung.util.StreamUtils; - -public class FileWriterTest { - - public static final String fileName = "src/main/resources/countries.properties"; - - @Test - public void whenAppendToFileUsingFileWriter_thenCorrect() throws IOException { - FileWriter fw = new FileWriter(fileName, true); - BufferedWriter bw = new BufferedWriter(fw); - bw.write("Spain"); - bw.newLine(); - bw.close(); - - assertThat( - StreamUtils.getStringFromInputStream( - new FileInputStream(fileName))) - .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\n"); - } - - @After - public void revertFile() throws IOException { - PrintWriter writer = new PrintWriter(fileName); - writer.print("UK\r\n" + "US\r\n" + "Germany\r\n"); - writer.close(); - } -} diff --git a/core-java/src/test/java/com/baeldung/file/FilesTest.java b/core-java/src/test/java/com/baeldung/file/FilesTest.java index bd39d004d3..e17e8580aa 100644 --- a/core-java/src/test/java/com/baeldung/file/FilesTest.java +++ b/core-java/src/test/java/com/baeldung/file/FilesTest.java @@ -2,14 +2,24 @@ package com.baeldung.file; import static org.assertj.core.api.Assertions.assertThat; +import java.io.BufferedWriter; +import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; +import com.google.common.base.Charsets; +import com.google.common.io.CharSink; +import com.google.common.io.FileWriteMode; +import org.apache.commons.io.FileUtils; import org.junit.After; +import org.junit.Before; import org.junit.Test; import com.baeldung.util.StreamUtils; @@ -18,6 +28,26 @@ public class FilesTest { public static final String fileName = "src/main/resources/countries.properties"; + @Before + @After + public void setup() throws Exception { + PrintWriter writer = new PrintWriter(fileName); + writer.print("UK\r\n" + "US\r\n" + "Germany\r\n"); + writer.close(); + } + + @Test + public void whenAppendToFileUsingGuava_thenCorrect() throws IOException { + File file = new File(fileName); + CharSink chs = com.google.common.io.Files.asCharSink(file, Charsets.UTF_8, FileWriteMode.APPEND); + chs.write("Spain\r\n"); + + assertThat(StreamUtils.getStringFromInputStream( + new FileInputStream(fileName))) + .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); + } + + @Test public void whenAppendToFileUsingFiles_thenCorrect() throws IOException { Files.write(Paths.get(fileName), "Spain\r\n".getBytes(), StandardOpenOption.APPEND); @@ -27,10 +57,38 @@ public class FilesTest { .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); } - @After - public void revertFile() throws IOException { - PrintWriter writer = new PrintWriter(fileName); - writer.print("UK\r\n" + "US\r\n" + "Germany\r\n"); - writer.close(); + @Test + public void whenAppendToFileUsingFileUtils_thenCorrect() throws IOException { + File file = new File(fileName); + FileUtils.writeStringToFile(file, "Spain\r\n", StandardCharsets.UTF_8, true); + + assertThat(StreamUtils.getStringFromInputStream( + new FileInputStream(fileName))) + .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); + } + + @Test + public void whenAppendToFileUsingFileOutputStream_thenCorrect() throws Exception { + FileOutputStream fos = new FileOutputStream(fileName, true); + fos.write("Spain\r\n".getBytes()); + fos.close(); + + assertThat(StreamUtils.getStringFromInputStream( + new FileInputStream(fileName))) + .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); + } + + @Test + public void whenAppendToFileUsingFileWriter_thenCorrect() throws IOException { + FileWriter fw = new FileWriter(fileName, true); + BufferedWriter bw = new BufferedWriter(fw); + bw.write("Spain"); + bw.newLine(); + bw.close(); + + assertThat( + StreamUtils.getStringFromInputStream( + new FileInputStream(fileName))) + .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\n"); } } diff --git a/core-java/src/test/java/com/baeldung/file/GuavaTest.java b/core-java/src/test/java/com/baeldung/file/GuavaTest.java deleted file mode 100644 index 5a7ec6c4a8..0000000000 --- a/core-java/src/test/java/com/baeldung/file/GuavaTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.baeldung.file; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.PrintWriter; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import com.baeldung.util.StreamUtils; -import com.google.common.base.Charsets; -import com.google.common.io.CharSink; -import com.google.common.io.FileWriteMode; -import com.google.common.io.Files; - -public class GuavaTest { - - public static final String fileName = "src/main/resources/countries.properties"; - - @Before - public void setup() throws Exception { - PrintWriter writer = new PrintWriter(fileName); - writer.print("UK\r\n" + "US\r\n" + "Germany\r\n"); - writer.close(); - } - - @Test - public void whenAppendToFileUsingGuava_thenCorrect() throws IOException { - File file = new File(fileName); - CharSink chs = Files.asCharSink(file, Charsets.UTF_8, FileWriteMode.APPEND); - chs.write("Spain\r\n"); - - assertThat(StreamUtils.getStringFromInputStream( - new FileInputStream(fileName))) - .isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); - } - - @After - public void revertFile() throws IOException { - PrintWriter writer = new PrintWriter(fileName); - writer.print("UK\r\n" + "US\r\n" + "Germany\r\n"); - writer.close(); - } -} diff --git a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java index 61d821e85e..614de6d3ad 100644 --- a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java +++ b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java @@ -1,6 +1,5 @@ package com.baeldung.hibernate.manytomany; - import java.util.HashSet; import java.util.Set; import org.hibernate.Session; @@ -17,10 +16,8 @@ import com.baeldung.hibernate.manytomany.model.Employee; import com.baeldung.hibernate.manytomany.model.Project; import com.baeldung.manytomany.spring.PersistenceConfig; - - @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = {PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) public class HibernateManyToManyAnnotationJavaConfigMainIntegrationTest { @Autowired @@ -28,7 +25,6 @@ public class HibernateManyToManyAnnotationJavaConfigMainIntegrationTest { private Session session; - @Before public final void before() { session = sessionFactory.openSession(); @@ -43,11 +39,11 @@ public class HibernateManyToManyAnnotationJavaConfigMainIntegrationTest { @Test public final void whenEntitiesAreCreated_thenNoExceptions() { - Set projects = new HashSet(); - projects.add(new Project("IT Project")); - projects.add(new Project("Networking Project")); - session.persist(new Employee("Peter", "Oven", projects)); - session.persist(new Employee("Allan", "Norman", projects)); + Set projects = new HashSet(); + projects.add(new Project("IT Project")); + projects.add(new Project("Networking Project")); + session.persist(new Employee("Peter", "Oven", projects)); + session.persist(new Employee("Allan", "Norman", projects)); } } diff --git a/undertow/dependency-reduced-pom.xml b/undertow/dependency-reduced-pom.xml new file mode 100644 index 0000000000..0654c82b74 --- /dev/null +++ b/undertow/dependency-reduced-pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + com.baeldung.undertow + undertow + undertow + 1.0-SNAPSHOT + http://maven.apache.org + + ${project.artifactId} + + + maven-shade-plugin + + + package + + shade + + + + + + maven-jar-plugin + + + + com.baeldung.undertow.SimpleServer + + + + + + + + 1.8 + 1.8 + + +