diff --git a/.idea/compiler.xml b/.idea/compiler.xml index ebe8da4553..b39c11ff88 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,16 +1,8 @@ - - - - - - - - - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d5a46f0b49..8050c4a787 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,38 +4,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + @@ -120,7 +93,7 @@ - + 1618147556538 @@ -150,7 +123,70 @@ - @@ -173,6 +209,15 @@ - \ No newline at end of file diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index 13bc01f216..ba849ccd3f 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -13,7 +13,7 @@ com.ossez parent-modules - 1.0.0 + 0.0.1 @@ -82,7 +82,7 @@ 3.3.0 1.0.22.RELEASE - 2.4.0 + 2.4.5 1.9.1 3.4.0 diff --git a/parent-java/pom.xml b/parent-java/pom.xml index 4e351d3735..7946e7b3ab 100644 --- a/parent-java/pom.xml +++ b/parent-java/pom.xml @@ -10,8 +10,8 @@ com.ossez - parent-modules - 1.0.0-SNAPSHOT + java-tutorials + 0.0.1 @@ -26,11 +26,20 @@ commons-io ${commons.io.version} + + com.google.code.gson + gson + 2.8.6 + + 23.0 2.6 + + + 3.8.1 diff --git a/pom.xml b/pom.xml index 7487ab15c0..38a594f332 100644 --- a/pom.xml +++ b/pom.xml @@ -2,24 +2,52 @@ - 4.0.0 com.ossez - lang-tutorial + parent-modules 0.0.1 + pom + + CWIKIUS-OSSEZ Java Parent Modules + CWIKIUS-OSSEZ Java Tutorials For Algorithm And Learning + https://www.ossez.com/ + + + https://github.com/cwiki-us-docs/java-tutorials.git + https://github.com/cwiki-us-docs/java-tutorials.git + + + + + YuCheng Hu + huyuchengus + huyuchengus@gmail.com + -5 + NORTH TECOM, LLC + + Java Developer + + + + + + + Apache 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + - 1.8 + 11 UTF-8 UTF-8 - 1.7.12 + 1.7.30 2.2 - 4.3.5.Final @@ -209,7 +237,7 @@ maven-compiler-plugin - 3.1 + 3.7.0 ${java.version} ${java.version} @@ -225,48 +253,68 @@ org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - - com.ossez.reoc.rets.Main - true - lib/ - - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.6 + maven-source-plugin + 2.2.1 - - package + attach-sources - single + jar-no-fork - - src/assembly/zipAssembly.xml - reoc-rets - - - com.ossez.reoc.rets.Main - - - ./ - - - - + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://oss.sonatype.org/ + true + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + diff --git a/spring-amqp/pom.xml b/spring-amqp/pom.xml index 3e6789dcb6..c98e919695 100644 --- a/spring-amqp/pom.xml +++ b/spring-amqp/pom.xml @@ -24,5 +24,4 @@ com.baeldung.springamqp.simple.HelloWorldMessageApp - diff --git a/spring-batch/pom.xml b/spring-batch/pom.xml new file mode 100644 index 0000000000..238f03afd7 --- /dev/null +++ b/spring-batch/pom.xml @@ -0,0 +1,116 @@ + + 4.0.0 + + spring-batch + 0.1-SNAPSHOT + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + + spring-batch + jar + + + parent-boot-2 + com.ossez + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + + + javax.xml.bind + jaxb-api + ${jaxb.version} + + + + org.glassfish.jaxb + jaxb-runtime + ${jaxb.version} + runtime + + + + + org.xerial + sqlite-jdbc + ${sqlite.version} + + + + org.springframework + spring-oxm + ${spring.version} + + + commons-logging + commons-logging + + + + + + org.springframework + spring-jdbc + ${spring.version} + + + + org.springframework.batch + spring-batch-core + ${spring.batch.version} + + + + org.springframework.batch + spring-batch-test + ${spring.batch.version} + + + + com.opencsv + opencsv + ${opencsv.version} + + + + org.springframework.boot + spring-boot-starter-batch + + + + org.hsqldb + hsqldb + runtime + + + + org.awaitility + awaitility + ${awaitility.version} + test + + + + + 5.3.0 + 4.3.0 + 3.15.1 + 4.1 + 2.3.1 + 3.1.1 + + diff --git a/spring-batch/src/main/java/com/ossez/spring/batch/SpringBatchConfig.java b/spring-batch/src/main/java/com/ossez/spring/batch/SpringBatchConfig.java index 89ee9ac60e..73a7858a3e 100644 --- a/spring-batch/src/main/java/com/ossez/spring/batch/SpringBatchConfig.java +++ b/spring-batch/src/main/java/com/ossez/spring/batch/SpringBatchConfig.java @@ -1,12 +1,12 @@ package com.ossez.spring.batch; -import org.baeldung.batch.model.Transaction; -import org.baeldung.batch.service.CustomItemProcessor; -import org.baeldung.batch.service.CustomSkipPolicy; -import org.baeldung.batch.service.MissingUsernameException; -import org.baeldung.batch.service.NegativeAmountException; -import org.baeldung.batch.service.RecordFieldSetMapper; -import org.baeldung.batch.service.SkippingItemProcessor; +import com.ossez.spring.batch.model.Transaction; +import com.ossez.spring.batch.service.CustomItemProcessor; +import com.ossez.spring.batch.service.CustomSkipPolicy; +import com.ossez.spring.batch.service.MissingUsernameException; +import com.ossez.spring.batch.service.NegativeAmountException; +import com.ossez.spring.batch.service.RecordFieldSetMapper; +import com.ossez.spring.batch.service.SkippingItemProcessor; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; diff --git a/spring-batch/src/main/java/com/ossez/spring/batch/model/Transaction.java b/spring-batch/src/main/java/com/ossez/spring/batch/model/Transaction.java index 0ce3a413ab..9349b747a4 100644 --- a/spring-batch/src/main/java/com/ossez/spring/batch/model/Transaction.java +++ b/spring-batch/src/main/java/com/ossez/spring/batch/model/Transaction.java @@ -1,8 +1,7 @@ -package org.baeldung.batch.model; - -import java.util.Date; +package com.ossez.spring.batch.model; import javax.xml.bind.annotation.XmlRootElement; +import java.util.Date; @SuppressWarnings("restriction") @XmlRootElement(name = "transactionRecord") diff --git a/spring-batch/src/main/java/com/ossez/spring/batch/partitioner/SpringbatchPartitionConfig.java b/spring-batch/src/main/java/com/ossez/spring/batch/partitioner/SpringbatchPartitionConfig.java index 21a8d00b51..7bf2977519 100644 --- a/spring-batch/src/main/java/com/ossez/spring/batch/partitioner/SpringbatchPartitionConfig.java +++ b/spring-batch/src/main/java/com/ossez/spring/batch/partitioner/SpringbatchPartitionConfig.java @@ -1,7 +1,7 @@ package com.ossez.spring.batch.partitioner; -import org.baeldung.batch.model.Transaction; -import org.baeldung.batch.service.RecordFieldSetMapper; +import com.ossez.spring.batch.model.Transaction; +import com.ossez.spring.batch.service.RecordFieldSetMapper; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; diff --git a/spring-batch/src/main/java/com/ossez/spring/batch/service/RecordFieldSetMapper.java b/spring-batch/src/main/java/com/ossez/spring/batch/service/RecordFieldSetMapper.java index c8d0aefbb8..3729b3744f 100644 --- a/spring-batch/src/main/java/com/ossez/spring/batch/service/RecordFieldSetMapper.java +++ b/spring-batch/src/main/java/com/ossez/spring/batch/service/RecordFieldSetMapper.java @@ -3,7 +3,7 @@ package com.ossez.spring.batch.service; import java.text.ParseException; import java.text.SimpleDateFormat; -import org.baeldung.batch.model.Transaction; +import com.ossez.spring.batch.model.Transaction; import org.springframework.batch.item.file.mapping.FieldSetMapper; import org.springframework.batch.item.file.transform.FieldSet; import org.springframework.validation.BindException; diff --git a/spring-batch/src/main/java/com/ossez/spring/batch/service/SkippingItemProcessor.java b/spring-batch/src/main/java/com/ossez/spring/batch/service/SkippingItemProcessor.java index 6321137579..0333e2561e 100644 --- a/spring-batch/src/main/java/com/ossez/spring/batch/service/SkippingItemProcessor.java +++ b/spring-batch/src/main/java/com/ossez/spring/batch/service/SkippingItemProcessor.java @@ -1,6 +1,6 @@ package com.ossez.spring.batch.service; -import org.baeldung.batch.model.Transaction; +import com.ossez.spring.batch.model.Transaction; import org.springframework.batch.item.ItemProcessor; public class SkippingItemProcessor implements ItemProcessor { diff --git a/src/main/java/com/ossez/lang/tutorial/overview/HelloWorld.java b/src/main/java/com/ossez/lang/tutorial/overview/HelloWorld.java index 709a70ac21..471ec43175 100644 --- a/src/main/java/com/ossez/lang/tutorial/overview/HelloWorld.java +++ b/src/main/java/com/ossez/lang/tutorial/overview/HelloWorld.java @@ -2,37 +2,15 @@ package com.ossez.lang.tutorial.overview; /** * Java Tutorial - * -<<<<<<< HEAD + * * This is my first java program. This will print 'Hello World' as the output This is an example of multi-line comments - * -======= -<<<<<<< HEAD -======= - * This is my first java program. This will print 'Hello World' as the output This is an example of multi-line comments - * ->>>>>>> 361e407d91e00158295aadeaca0a91d84a534820 ->>>>>>> RB + * * @author YuCheng * */ public class HelloWorld { public static void main(String[] args) { -<<<<<<< HEAD -======= -<<<<<<< HEAD - System.out.println("Hello World"); - } -} -======= ->>>>>>> RB - // This is an example of single line comment - /* This is also an example of single line comment. */ System.out.println("Hello World"); } } -<<<<<<< HEAD -======= ->>>>>>> 361e407d91e00158295aadeaca0a91d84a534820 ->>>>>>> RB diff --git a/src/test/java/com/ossez/lang/tutorial/tests/DiscourseImportTest.java b/src/test/java/com/ossez/lang/tutorial/tests/DiscourseImportTest.java deleted file mode 100644 index 27cce33d49..0000000000 --- a/src/test/java/com/ossez/lang/tutorial/tests/DiscourseImportTest.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.ossez.lang.tutorial.tests; - -import com.google.gson.Gson; -import com.ossez.edtestbank.common.dao.Factory; -import com.ossez.edtestbank.common.dao.factories.PostFactory; -import com.ossez.edtestbank.common.model.entity.BBSOssezForumAttach; -import com.ossez.edtestbank.common.model.entity.BBSOssezForumPost; -import com.ossez.edtestbank.common.model.request.TopicRequest; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; -import org.apache.http.HttpHeaders; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.joda.time.DateTime; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * Test Logger and function - * - * @author YuCheng Hu - */ -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -public class PostTest { - private static Logger logger = LoggerFactory.getLogger(PostTest.class); - - - @BeforeAll - protected void setUp() throws Exception { - Factory.beginTransaction(); - } - - @AfterAll - protected void tearDown() throws Exception { - Factory.rollbackTransaction(); - } - - /** - * Tests search functionality for the customer object. - */ - @Test - public void testPost() throws IOException, InterruptedException { - List idList = FileUtils.readLines(new File("C:\\Users\\yhu\\Pictures\\Pics\\2021-01\\1.txt")); - for (String id : idList) { - processPost(NumberUtils.toLong(id)); - Thread.sleep(6000); -// break; - - } - - - // make sure the customer was found -// assertNotNull(bbsOssezForumPost); - } - - @Test - public void testDateTime() throws IOException { - DateTime dateTime = new DateTime(1256834117 * 1000L); - System.out.println(dateTime.toString()); - - } - - private void processPost(Long tid) throws IOException { - BBSOssezForumPost bbsOssezForumPost = PostFactory.getBBSOssezForumPostTid(tid); - if (bbsOssezForumPost == null) - return; - - logger.debug("Questions Content - {}", bbsOssezForumPost.getSubject()); - - String postCtx = bbsOssezForumPost.getMessage(); -// logger.debug(">>>>{}", postCtx); - - - String pattern = "\\[attach\\]((\\d)*?)\\[\\/attach\\]"; - - // Create a Pattern object - Pattern r = Pattern.compile(pattern); - - // Now create matcher object. - Matcher m = r.matcher(postCtx); - - while (m.find()) { - String attachId = StringUtils.substringBetween(m.group(0), "[attach]", "[/attach]"); - logger.debug("{}", attachId); - BBSOssezForumAttach bbsOssezForumAttach = PostFactory.getBBSOssezForumAttach(NumberUtils.toLong(attachId)); - if (bbsOssezForumAttach!= null) { - String fullURL = "![](https://cdn.ossez.com/com-ossez-www/data/attachment/forum/" + bbsOssezForumAttach.getAttachment() + ")"; - postCtx = StringUtils.replace(postCtx, m.group(0), fullURL); - } - } - - logger.debug("{}", postCtx); - - - CloseableHttpClient client = HttpClients.createDefault(); - - HttpPost httpPost = new HttpPost("https://www.ossez.com/posts.json"); - httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8"); - httpPost.setHeader("Api-Key", "XXXXXX"); - httpPost.setHeader("Api-Username", "XXXXXX"); - - TopicRequest topicRequest = new TopicRequest(); - topicRequest.setTitle(bbsOssezForumPost.getSubject()); - topicRequest.setRaw(postCtx); - topicRequest.setCreated_at(new DateTime(bbsOssezForumPost.getDateline() * 1000L).toString() ); - topicRequest.setCategory(30); - - StringEntity postingString = new StringEntity(new Gson().toJson(topicRequest), StandardCharsets.UTF_8); - - httpPost.setEntity(postingString); - - - CloseableHttpResponse response = client.execute(httpPost); - - logger.info("{}", EntityUtils.toString(response.getEntity()), StandardCharsets.UTF_8); - client.close(); - } - -} diff --git a/toolkits/.idea/compiler.xml b/toolkits/.idea/compiler.xml index 3c6a21132c..45d2ba3bd2 100644 --- a/toolkits/.idea/compiler.xml +++ b/toolkits/.idea/compiler.xml @@ -10,7 +10,7 @@ - + diff --git a/toolkits/codebank/pom.xml b/toolkits/codebank/pom.xml new file mode 100644 index 0000000000..9364a13ffc --- /dev/null +++ b/toolkits/codebank/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + com.ossez + codebank + 0.0.1 + codebank + jar + + + com.ossez + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + + + + + org.apache.commons + commons-lang3 + 3.11 + + + org.apache.httpcomponents + httpclient + 4.5.13 + + + + joda-time + joda-time + 2.10.10 + + + + javax.persistence + javax.persistence-api + 2.2 + + + + + discourse + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + + + + src/main/resources + true + + + + + + + 3.6.1 + 1.8.9 + 1.19 + 1.19 + + + diff --git a/toolkits/discourse/pom.xml b/toolkits/discourse/pom.xml index cdc23f2d83..029e363b0d 100644 --- a/toolkits/discourse/pom.xml +++ b/toolkits/discourse/pom.xml @@ -27,11 +27,6 @@ 4.5.13 - - com.google.code.gson - gson - 2.8.6 - joda-time joda-time @@ -72,8 +67,6 @@ 1.8.9 1.19 1.19 - - 2.22.1 diff --git a/toolkits/discourse/src/test/java/com/ossez/toolkits/discourse/DiscourseTopicsImportTest.java b/toolkits/discourse/src/test/java/com/ossez/toolkits/discourse/DiscourseTopicsImportTest.java index 281905bf79..a31671b8e1 100644 --- a/toolkits/discourse/src/test/java/com/ossez/toolkits/discourse/DiscourseTopicsImportTest.java +++ b/toolkits/discourse/src/test/java/com/ossez/toolkits/discourse/DiscourseTopicsImportTest.java @@ -112,8 +112,8 @@ public class DiscourseTopicsImportTest { HttpPost httpPost = new HttpPost("https://www.ossez.com/posts.json"); httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8"); - httpPost.setHeader("Api-Key", "8d789c529c4c22bf1dac3de7dbe7b29af10f2429aeb9a1914eff6da70c2265a9"); - httpPost.setHeader("Api-Username", "honeymoose"); + httpPost.setHeader("Api-Key", "XXXX"); + httpPost.setHeader("Api-Username", "XXXX"); TopicRequest topicRequest = new TopicRequest(); topicRequest.setTitle(bbsOssezForumPost.getSubject());