From a228fa25f3ceb689d0f99085c2c4e16715b14a15 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 15 Apr 2021 12:15:45 -0400 Subject: [PATCH 01/12] adjust the pom to make project can be compile --- .idea/compiler.xml | 8 --- .idea/workspace.xml | 61 +++++++++---------- parent-java/pom.xml | 13 +++- pom.xml | 37 +---------- spring-amqp/pom.xml | 1 - .../lang/tutorial/overview/HelloWorld.java | 26 +------- toolkits/.idea/compiler.xml | 2 +- toolkits/discourse/pom.xml | 7 --- .../discourse/DiscourseTopicsImportTest.java | 4 +- 9 files changed, 47 insertions(+), 112 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index ebe8da4553..ad4d6736a5 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,14 +1,6 @@ - - - - - - - - diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d5a46f0b49..c60aa19867 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,38 +4,16 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + @@ -120,7 +99,7 @@ - + 1618147556538 @@ -150,7 +129,21 @@ - @@ -173,6 +166,8 @@ - \ No newline at end of file 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..3d27861f03 100644 --- a/pom.xml +++ b/pom.xml @@ -2,12 +2,12 @@ - 4.0.0 com.ossez - lang-tutorial + java-tutorials 0.0.1 + pom @@ -16,10 +16,9 @@ UTF-8 - 1.7.12 + 1.7.30 2.2 - 4.3.5.Final @@ -236,37 +235,7 @@ - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.6 - - - - package - - single - - - src/assembly/zipAssembly.xml - reoc-rets - - - com.ossez.reoc.rets.Main - - - ./ - - - - - - - - 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/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/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/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()); From 96ad7aeb24d8f279dfecea66b94a7dceacfe475d Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 15 Apr 2021 12:17:25 -0400 Subject: [PATCH 02/12] DiscourseImportTest move to different project --- .../tutorial/tests/DiscourseImportTest.java | 137 ------------------ 1 file changed, 137 deletions(-) delete mode 100644 src/test/java/com/ossez/lang/tutorial/tests/DiscourseImportTest.java 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(); - } - -} From c9962462fc098637888f5bf3fdeff2f8639c7c89 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 15 Apr 2021 13:55:36 -0400 Subject: [PATCH 03/12] Change the compiler version to 3.7.0 version --- .idea/workspace.xml | 30 ++++++++++++++++++++---------- parent-boot-2/pom.xml | 2 +- pom.xml | 4 ++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c60aa19867..7027af93e1 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,15 +5,9 @@ - - + - - - - - @@ -168,6 +176,8 @@ - \ No newline at end of file diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index 13bc01f216..a4c2fafaa7 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -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/pom.xml b/pom.xml index 3d27861f03..3175e0d049 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.ossez - java-tutorials + parent-modules 0.0.1 pom @@ -208,7 +208,7 @@ maven-compiler-plugin - 3.1 + 3.7.0 ${java.version} ${java.version} From 03f9c0cca940e917abce770d5e6991cf553e5f7f Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 15 Apr 2021 15:33:18 -0400 Subject: [PATCH 04/12] =?UTF-8?q?=E6=8F=90=E4=BA=A4=20OSSRH=20=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 15 ++++++--- pom.xml | 81 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 82 insertions(+), 14 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7027af93e1..180a7374f5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,7 +6,6 @@ - @@ -178,6 +184,7 @@ - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3175e0d049..46940eba5f 100644 --- a/pom.xml +++ b/pom.xml @@ -223,19 +223,80 @@ - org.apache.maven.plugins - maven-jar-plugin - 2.6 + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true - - - com.ossez.reoc.rets.Main - true - lib/ - - + ossrh + https://oss.sonatype.org/ + true + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + 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/ + + + From 1931ec6739d644f44e58ccb0e07b8c270a41bc0d Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 15 Apr 2021 16:41:09 -0400 Subject: [PATCH 05/12] Add name and URL before push to OSSRH --- .idea/workspace.xml | 15 ++++++++++++--- pom.xml | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 180a7374f5..84eac91aa8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -53,6 +53,7 @@ + @@ -92,7 +93,7 @@ - + 1618147556538 @@ -157,7 +158,14 @@ - @@ -185,6 +193,7 @@ - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 46940eba5f..95a91e018c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,9 @@ 0.0.1 pom + CWIKIUS-OSSEZ Java Tutorials For Algorithm And Learning + https://www.ossez.com/ + 1.8 From ac38f3fc9cb5eae5e24a736c511782abf6a17a70 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Thu, 15 Apr 2021 16:43:59 -0400 Subject: [PATCH 06/12] Upgrade to using JDK 11 --- .idea/workspace.xml | 14 +++++++++++--- pom.xml | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 84eac91aa8..761171be6c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -93,7 +93,7 @@ - + 1618147556538 @@ -165,7 +165,14 @@ -